Contents

constant(_:shape:dataType:)

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

Declaration

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

Parameters

  • scalar:

    The scalar value to fill the entire tensor values with.

  • shape:

    The shape of the output tensor.

  • dataType:

    The dataType of the constant tensor.

Return Value

A valid MPSGraphTensor object.