Contents

BNNSTile(_:_:_:)

Generates an output tensor by tiling an input tensor multiple times.

Declaration

func BNNSTile(_ input: UnsafePointer<BNNSNDArrayDescriptor>, _ output: UnsafeMutablePointer<BNNSNDArrayDescriptor>, _ filter_params: UnsafePointer<BNNSFilterParameters>?) -> Int32

Parameters

  • input:

    A pointer to the input descriptor.

  • output:

    A pointer to the output descriptor.

  • filter_params:

    The filter runtime parameters.

Discussion

Use BNNSTile(_:_:_:) to tile generate a tensor by repeating tiled copies of the input tensor. The dimensions of the output tensor must be an integer multiple of the corresponding dimension of the input tensor.

For example, the following code tiles a 2 x 3 matrix three times along the first dimension and twice along the second dimension:

let values: [Float] = [1.0, 2.0, 3.0,
                       4.0, 5.0, 6.0]

var inputDescriptor = BNNSNDArrayDescriptor.allocate(
    initializingFrom: values,
    shape: .matrixRowMajor(2, 3))

var outputDescriptor = BNNSNDArrayDescriptor.allocateUninitialized(
    scalarType: Float.self,
    shape: .matrixRowMajor(6, 6))

BNNSTile(&inputDescriptor, &outputDescriptor, nil)

inputDescriptor.deallocate()
outputDescriptor.deallocate()

On return, outputDescriptor contains the following values:

[ 1.0, 2.0, 3.0,  1.0, 2.0, 3.0,
  4.0, 5.0, 6.0,  4.0, 5.0, 6.0,

  1.0, 2.0, 3.0,  1.0, 2.0, 3.0,
  4.0, 5.0, 6.0,  4.0, 5.0, 6.0,

  1.0, 2.0, 3.0,  1.0, 2.0, 3.0,
  4.0, 5.0, 6.0,  4.0, 5.0, 6.0 ]

See Also

Errors