Contents

constant(_:shape:dataType:)

Creates a constant op with a given shape and data, and returns the result tensor.

Declaration

func constant(_ data: Data, shape: [NSNumber], dataType: MPSDataType) -> MPSGraphTensor

Parameters

  • data:

    The data for the tensor. The number of bytes should be sizeof(dataType)numberOfElements.

  • shape:

    The shape of the output tensor. This has to be statically shaped.

  • dataType:

    The dataType of theconstant tensor.

Return Value

A valid MPSGraphTensor object.