NSDictionary(TIOData)

@interface NSDictionary (TIOData)

NSDictionary conforms to TIOData so that it may be passed as input to a model and returned as output from a model.

@warning A dictionary can neither provide bytes directly to nor capture bytes directly from a tensor. Instead the named entries of the dictionary must be able to do so.

  • Initializes an NSDictionary object with bytes from a tensor.

    Warning

    This method is unimplemented. A dictionary cannot be constructed directly from a tensor.

    Declaration

    Objective-C

    - (nullable instancetype)initWithBytes:(nonnull const void *)bytes
                                    length:(NSUInteger)length
                               description:
                                   (nonnull id<TIOLayerDescription>)description;

    Swift

    convenience init?(bytes: UnsafeRawPointer, length: UInt, description: TIOLayerDescription)

    Parameters

    bytes

    The output buffer to read from.

    length

    The length of the buffer.

    description

    A description of the data this buffer produces.

    Return Value

    instancetype An empty dictionary.

  • Request to fill a tensor with bytes.

    Warning

    This method is unimplemented. A dictionary cannot provide bytes directly to a tensor.

    Declaration

    Objective-C

    - (void)getBytes:(nonnull void *)buffer
              length:(NSUInteger)length
         description:(nonnull id<TIOLayerDescription>)description;

    Swift

    func getBytes(_ buffer: UnsafeMutableRawPointer, length: UInt, description: TIOLayerDescription)

    Parameters

    buffer

    The input buffer to copy bytes to.

    length

    The length of the input buffer.

    description

    A description of the data this buffer expects.