broadcast(_:shape:name:)
Creates a broadcast operation and returns the result tensor.
Declaration
func broadcast(_ tensor: MPSGraphTensor, shape: [NSNumber], name: String?) -> MPSGraphTensorParameters
- tensor:
The tensor to be broadcasted
- shape:
The shape of the result tensor.
- name:
The name for the operation.
Return Value
A valid MPSGraphTensor object
Discussion
Broadcasts values inside the tensor, starting from the trailing dimensions, to give it the correct shape. This is equivalent to the broadcasting for arithmetic operations when operands have different shapes.