TIOData

@protocol TIOData <NSObject>

A TIOData is any data type that knows how to provide bytes to a input tensor and how to read bytes from an output tensor.

  • Initializes a conforming object with bytes from a tensor.

    Declaration

    Objective-C

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

    Swift

    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 instance of the conforming data type.

  • Requests that a conforming object fill the tensor with bytes.

    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.