Contents

subtraction(_:_:name:)

Subtracts the second input tensor from the first.

Declaration

func subtraction(_ primaryTensor: MPSGraphTensor, _ secondaryTensor: MPSGraphTensor, name: String?) -> MPSGraphTensor

Parameters

  • primaryTensor:

    The LHS tensor of the binary Op.

  • secondaryTensor:

    The RHS tensor of the binary Op.

  • name:

    An optional string which serves as an identifier for the operation.

Return Value

A valid MPSGraphTensor object containing the elementwise result of the applied operation.

Discussion

This operation creates a subtract operation and returns the result tensor. It supports broadcasting as well.

resultTensor = primaryTensor - secondaryTensor