metalperformanceshadersgraph

package
v0.6.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package metalperformanceshadersgraph provides Go bindings for the MetalPerformanceShadersGraph framework.

Build, compile, and execute compute graphs utilizing all the different compute devices on the platform, including GPU, CPU, and Neural Engine.

Metal Performance Shaders Graph provides high-performance, energy-efficient computation on Apple platforms by leveraging different hardware compute blocks. You can use this framework to generate a symbolic compute graph of operations, where each operation can output a set of tensors used as edges of the graph. The tensors represent multidimensional data that objects like [MTLBuffer] or [MTLTexture] can back. After you construct the graph, you can compile it into an executable to optimize for performance and subsequently run the executable on your input data. This framework also provides the ability to serialize the executables and load executables from a serialized `XCUIElementTypeMpsgraphpackage`.

Essentials

Classes

Type Aliases

Enumerations

Key Types

Code generated from Apple documentation. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMPSGraphCompilationCompletionHandlerBlock

func NewMPSGraphCompilationCompletionHandlerBlock(handler MPSGraphCompilationCompletionHandler) (objc.ID, func())

NewMPSGraphCompilationCompletionHandlerBlock wraps a Go MPSGraphCompilationCompletionHandler as an Objective-C block. The caller must defer the returned cleanup function.

func NewMPSGraphCompletionHandlerBlock

func NewMPSGraphCompletionHandlerBlock(handler MPSGraphCompletionHandler) (objc.ID, func())

NewMPSGraphCompletionHandlerBlock wraps a Go MPSGraphCompletionHandler as an Objective-C block. The caller must defer the returned cleanup function.

func NewMPSGraphExecutableErrorBlock

func NewMPSGraphExecutableErrorBlock(handler MPSGraphExecutableErrorHandler) (objc.ID, func())

NewMPSGraphExecutableErrorBlock wraps a Go MPSGraphExecutableErrorHandler as an Objective-C block. The caller must defer the returned cleanup function.

func NewMPSGraphScheduledHandlerBlock

func NewMPSGraphScheduledHandlerBlock(handler MPSGraphScheduledHandler) (objc.ID, func())

NewMPSGraphScheduledHandlerBlock wraps a Go MPSGraphScheduledHandler as an Objective-C block. The caller must defer the returned cleanup function.

func NewMPSGraphTensorDataArrayErrorBlock

func NewMPSGraphTensorDataArrayErrorBlock(handler MPSGraphTensorDataArrayErrorHandler) (objc.ID, func())

NewMPSGraphTensorDataArrayErrorBlock wraps a Go MPSGraphTensorDataArrayErrorHandler as an Objective-C block. The caller must defer the returned cleanup function.

Types

type IMPSGraph

type IMPSGraph interface {
	IMPSGraphObject

	// Options for the graph.
	Options() MPSGraphOptions
	SetOptions(value MPSGraphOptions)
	// Array of all the placeholder tensors.
	PlaceholderTensors() []MPSGraphTensor

	// Creates a GRU operation and returns the value and optionally the training state tensor.
	GRUWithSourceTensorRecurrentWeightInputWeightBiasDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, descriptor IMPSGraphGRUDescriptor, name string) []MPSGraphTensor
	// Creates a GRU operation and returns the value and optionally the training state tensor.
	GRUWithSourceTensorRecurrentWeightInputWeightBiasInitStateDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, descriptor IMPSGraphGRUDescriptor, name string) []MPSGraphTensor
	// Creates a GRU operation and returns the value and optionally the training state tensor.
	GRUWithSourceTensorRecurrentWeightInputWeightBiasInitStateMaskSecondaryBiasDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, mask IMPSGraphTensor, secondaryBias IMPSGraphTensor, descriptor IMPSGraphGRUDescriptor, name string) []MPSGraphTensor
	// Creates a GRU gradient operation and returns the gradient tensor values.
	GRUGradientsWithSourceTensorRecurrentWeightSourceGradientZStateOutputFwdInputWeightBiasDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, sourceGradient IMPSGraphTensor, zState IMPSGraphTensor, outputFwd IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, descriptor IMPSGraphGRUDescriptor, name string) []MPSGraphTensor
	// Creates a GRU gradient operation and returns the gradient tensor values.
	GRUGradientsWithSourceTensorRecurrentWeightSourceGradientZStateOutputFwdInputWeightBiasInitStateDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, sourceGradient IMPSGraphTensor, zState IMPSGraphTensor, outputFwd IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, descriptor IMPSGraphGRUDescriptor, name string) []MPSGraphTensor
	// Creates a GRU gradient operation and returns the gradient tensor values.
	GRUGradientsWithSourceTensorRecurrentWeightSourceGradientZStateOutputFwdStateGradientInputWeightBiasInitStateMaskSecondaryBiasDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, sourceGradient IMPSGraphTensor, zState IMPSGraphTensor, outputFwd IMPSGraphTensor, stateGradient IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, mask IMPSGraphTensor, secondaryBias IMPSGraphTensor, descriptor IMPSGraphGRUDescriptor, name string) []MPSGraphTensor
	// Computes the hamming distance of two input tensors with support for broadcasting.
	HammingDistanceWithPrimaryTensorSecondaryTensorResultDataTypeName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, resultDataType uint32, name string) IMPSGraphTensor
	// Creates a Hermitean-to-real fast Fourier transform operation and returns the result tensor.
	HermiteanToRealFFTWithTensorAxesDescriptorName(tensor IMPSGraphTensor, axes []foundation.NSNumber, descriptor IMPSGraphFFTDescriptor, name string) IMPSGraphTensor
	// Creates a Hermitean-to-real fast Fourier transform operation and returns the result tensor.
	HermiteanToRealFFTWithTensorAxesTensorDescriptorName(tensor IMPSGraphTensor, axesTensor IMPSGraphTensor, descriptor IMPSGraphFFTDescriptor, name string) IMPSGraphTensor
	// Creates a 4D L2-norm pooling operation and returns the result tensor.
	L2NormPooling4DWithSourceTensorDescriptorName(source IMPSGraphTensor, descriptor IMPSGraphPooling4DOpDescriptor, name string) IMPSGraphTensor
	// Creates a L2-Norm pooling gradient operation and returns the result tensor.
	L2NormPooling4DGradientWithGradientTensorSourceTensorDescriptorName(gradient IMPSGraphTensor, source IMPSGraphTensor, descriptor IMPSGraphPooling4DOpDescriptor, name string) IMPSGraphTensor
	// Creates an LSTM operation and returns the value tensor and optionally the cell state tensor and  the training state tensor.
	LSTMWithSourceTensorRecurrentWeightInitStateInitCellDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, initState IMPSGraphTensor, initCell IMPSGraphTensor, descriptor IMPSGraphLSTMDescriptor, name string) []MPSGraphTensor
	// Creates an LSTM operation and returns the value tensor and optionally the cell state tensor and  the training state tensor.
	LSTMWithSourceTensorRecurrentWeightInputWeightBiasInitStateInitCellDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, initCell IMPSGraphTensor, descriptor IMPSGraphLSTMDescriptor, name string) []MPSGraphTensor
	// Creates an LSTM operation and returns the value tensor and optionally the cell state tensor and  the training state tensor.
	LSTMWithSourceTensorRecurrentWeightInputWeightBiasInitStateInitCellMaskPeepholeDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, initCell IMPSGraphTensor, mask IMPSGraphTensor, peephole IMPSGraphTensor, descriptor IMPSGraphLSTMDescriptor, name string) []MPSGraphTensor
	// Creates an LSTM gradient operation and returns the gradient tensor values.
	LSTMGradientsWithSourceTensorRecurrentWeightSourceGradientZStateCellOutputFwdDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, sourceGradient IMPSGraphTensor, zState IMPSGraphTensor, cellOutputFwd IMPSGraphTensor, descriptor IMPSGraphLSTMDescriptor, name string) []MPSGraphTensor
	// Creates an LSTM gradient operation and returns the gradient tensor values.
	LSTMGradientsWithSourceTensorRecurrentWeightSourceGradientZStateCellOutputFwdInputWeightBiasInitStateInitCellDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, sourceGradient IMPSGraphTensor, zState IMPSGraphTensor, cellOutputFwd IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, initCell IMPSGraphTensor, descriptor IMPSGraphLSTMDescriptor, name string) []MPSGraphTensor
	// Creates an LSTM gradient operation and returns the gradient tensor values.
	LSTMGradientsWithSourceTensorRecurrentWeightSourceGradientZStateCellOutputFwdInputWeightBiasInitStateInitCellMaskDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, sourceGradient IMPSGraphTensor, zState IMPSGraphTensor, cellOutputFwd IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, initCell IMPSGraphTensor, mask IMPSGraphTensor, descriptor IMPSGraphLSTMDescriptor, name string) []MPSGraphTensor
	// Creates an LSTM gradient operation and returns the gradient tensor values.
	LSTMGradientsWithSourceTensorRecurrentWeightSourceGradientZStateCellOutputFwdStateGradientCellGradientInputWeightBiasInitStateInitCellMaskPeepholeDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, sourceGradient IMPSGraphTensor, zState IMPSGraphTensor, cellOutputFwd IMPSGraphTensor, stateGradient IMPSGraphTensor, cellGradient IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, initCell IMPSGraphTensor, mask IMPSGraphTensor, peephole IMPSGraphTensor, descriptor IMPSGraphLSTMDescriptor, name string) []MPSGraphTensor
	// Returns the absolute values of the input tensor elements.
	AbsoluteWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Returns the absolute square of the input tensor elements.
	AbsoluteSquareWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Applies the inverse cosine operation to the input tensor elements.
	AcosWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Applies the inverse hyperbolic cosine operation to the input tensor elements.
	AcoshWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates operations to apply Adam optimization.
	AdamWithCurrentLearningRateTensorBeta1TensorBeta2TensorEpsilonTensorValuesTensorMomentumTensorVelocityTensorMaximumVelocityTensorGradientTensorName(currentLearningRateTensor IMPSGraphTensor, beta1Tensor IMPSGraphTensor, beta2Tensor IMPSGraphTensor, epsilonTensor IMPSGraphTensor, valuesTensor IMPSGraphTensor, momentumTensor IMPSGraphTensor, velocityTensor IMPSGraphTensor, maximumVelocityTensor IMPSGraphTensor, gradientTensor IMPSGraphTensor, name string) []MPSGraphTensor
	// Creates operations to apply Adam optimization.
	AdamWithLearningRateTensorBeta1TensorBeta2TensorEpsilonTensorBeta1PowerTensorBeta2PowerTensorValuesTensorMomentumTensorVelocityTensorMaximumVelocityTensorGradientTensorName(learningRateTensor IMPSGraphTensor, beta1Tensor IMPSGraphTensor, beta2Tensor IMPSGraphTensor, epsilonTensor IMPSGraphTensor, beta1PowerTensor IMPSGraphTensor, beta2PowerTensor IMPSGraphTensor, valuesTensor IMPSGraphTensor, momentumTensor IMPSGraphTensor, velocityTensor IMPSGraphTensor, maximumVelocityTensor IMPSGraphTensor, gradientTensor IMPSGraphTensor, name string) []MPSGraphTensor
	// Adds two input tensors.
	AdditionWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// The Stochastic gradient descent performs a gradient descent `variable = variable - (learningRate * g)` where, `g` is gradient of error wrt variable this op directly writes to the variable
	ApplyStochasticGradientDescentWithLearningRateTensorVariableGradientTensorName(learningRateTensor IMPSGraphTensor, variable IMPSGraphVariableOp, gradientTensor IMPSGraphTensor, name string) IMPSGraphOperation
	// Computes the indices that sort the elements of the input tensor along the specified axis.
	ArgSortWithTensorAxisDescendingName(tensor IMPSGraphTensor, axis int, descending bool, name string) IMPSGraphTensor
	// Computes the indices that sort the elements of the input tensor along the specified axis.
	ArgSortWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor
	// Computes the indices that sort the elements of the input tensor along the specified axis.
	ArgSortWithTensorAxisTensorDescendingName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, descending bool, name string) IMPSGraphTensor
	// Computes the indices that sort the elements of the input tensor along the specified axis.
	ArgSortWithTensorAxisTensorName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Applies the inverse sine operation to the input tensor elements.
	AsinWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Applies the inverse hyperbolic sine operation to the input tensor elements.
	AsinhWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates an assign operation which writes at this point of execution of the graph.
	AssignVariableWithValueOfTensorName(variable IMPSGraphTensor, tensor IMPSGraphTensor, name string) IMPSGraphOperation
	// Applies the inverse tangent operation to the input tensor elements.
	AtanWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Returns the elementwise two-argument arctangent of the input tensors.
	Atan2WithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Applies the inverse hyperbolic tangent operation to the input tensor elements.
	AtanhWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a 2D average-pooling operation and returns the result tensor.
	AvgPooling2DWithSourceTensorDescriptorName(source IMPSGraphTensor, descriptor IMPSGraphPooling2DOpDescriptor, name string) IMPSGraphTensor
	// Creates a 2D average pooling gradient operation and returns the result tensor.
	AvgPooling2DGradientWithGradientTensorSourceTensorDescriptorName(gradient IMPSGraphTensor, source IMPSGraphTensor, descriptor IMPSGraphPooling2DOpDescriptor, name string) IMPSGraphTensor
	// Creates a 4D average pooling operation and returns the result tensor.
	AvgPooling4DWithSourceTensorDescriptorName(source IMPSGraphTensor, descriptor IMPSGraphPooling4DOpDescriptor, name string) IMPSGraphTensor
	// Creates an average pooling gradient operation and returns the result tensor.
	AvgPooling4DGradientWithGradientTensorSourceTensorDescriptorName(gradient IMPSGraphTensor, source IMPSGraphTensor, descriptor IMPSGraphPooling4DOpDescriptor, name string) IMPSGraphTensor
	// Computes the band part of an input tensor.
	BandPartWithTensorNumLowerNumUpperName(inputTensor IMPSGraphTensor, numLower int, numUpper int, name string) IMPSGraphTensor
	// Creates the band part operation and returns the result.
	BandPartWithTensorNumLowerTensorNumUpperTensorName(inputTensor IMPSGraphTensor, numLowerTensor IMPSGraphTensor, numUpperTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a batch-to-space operation and returns the result tensor.
	BatchToSpaceTensorSpatialAxesBatchAxisBlockDimensionsUsePixelShuffleOrderName(tensor IMPSGraphTensor, spatialAxes []foundation.NSNumber, batchAxis int, blockDimensions []foundation.NSNumber, usePixelShuffleOrder bool, name string) IMPSGraphTensor
	// Creates a batch-to-space operation and returns the result tensor.
	BatchToSpaceTensorSpatialAxesTensorBatchAxisTensorBlockDimensionsTensorUsePixelShuffleOrderName(tensor IMPSGraphTensor, spatialAxesTensor IMPSGraphTensor, batchAxisTensor IMPSGraphTensor, blockDimensionsTensor IMPSGraphTensor, usePixelShuffleOrder bool, name string) IMPSGraphTensor
	// Returns the elementwise bitwise AND of binary representations of two integer tensors.
	BitwiseANDWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Returns the elementwise left-shifted binary representations of the primary integer by the secondary tensor amount.
	BitwiseLeftShiftWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Applies the bitwise NOT operation to the input tensor element.
	BitwiseNOTWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Returns the elementwise bitwise OR of binary representations of two integer tensors.
	BitwiseORWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Returns the population count of the input tensor elements.
	BitwisePopulationCountWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Returns the elementwise right-shifted binary representations of the primary integer by the secondary tensor amount.
	BitwiseRightShiftWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Returns the elementwise bitwise XOR of binary representations of two integer tensors.
	BitwiseXORWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a BottomK operation and returns the value and indices tensors.
	BottomKWithSourceTensorAxisKName(source IMPSGraphTensor, axis int, k uint, name string) []MPSGraphTensor
	// Creates a BottomK operation and returns the result tensor.
	BottomKWithSourceTensorAxisTensorKTensorName(source IMPSGraphTensor, axisTensor IMPSGraphTensor, kTensor IMPSGraphTensor, name string) []MPSGraphTensor
	// Creates a BottomKGradient operation and returns the result tensor.
	BottomKWithGradientTensorSourceAxisKName(gradient IMPSGraphTensor, source IMPSGraphTensor, axis int, k uint, name string) IMPSGraphTensor
	// Creates a BottomKGradient operation and returns the result tensor.
	BottomKWithGradientTensorSourceAxisTensorKTensorName(gradient IMPSGraphTensor, source IMPSGraphTensor, axisTensor IMPSGraphTensor, kTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a broadcast operation and returns the result tensor.
	BroadcastTensorToShapeName(tensor IMPSGraphTensor, shape foundation.NSArray, name string) IMPSGraphTensor
	// Creates a broadcast operation and returns the result tensor.
	BroadcastTensorToShapeTensorName(tensor IMPSGraphTensor, shapeTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates an operation which invokes another executable.
	CallSymbolNameInputTensorsOutputTypesName(symbolName string, inputTensors []MPSGraphTensor, outputTypes []MPSGraphType, name string) []MPSGraphTensor
	// Creates a cast operation and returns the result tensor.
	CastTensorToTypeName(tensor IMPSGraphTensor, type_ uint32, name string) IMPSGraphTensor
	// Applies the ceiling operation to the input tensor elements.
	CeilWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Clamps the values in the first tensor between the corresponding values in the minimum and maximum value tensor.
	ClampWithTensorMinValueTensorMaxValueTensorName(tensor IMPSGraphTensor, minValueTensor IMPSGraphTensor, maxValueTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a column to image operation and returns the result tensor.
	ColToImWithSourceTensorOutputShapeDescriptorName(source IMPSGraphTensor, outputShape foundation.NSArray, descriptor IMPSGraphImToColOpDescriptor, name string) IMPSGraphTensor
	// Compiles the graph for the given feeds to returns the target tensor values, ensuring all target operations would be executed.
	CompileWithDeviceFeedsTargetTensorsTargetOperationsCompilationDescriptor(device IMPSGraphDevice, feeds MPSGraphTensorShapedTypeDictionary, targetTensors []MPSGraphTensor, targetOperations []MPSGraphOperation, compilationDescriptor IMPSGraphCompilationDescriptor) IMPSGraphExecutable
	// Creates a complex constant op with the MPSDataTypeComplexFloat32 data type and returns the result tensor.
	ConstantWithRealPartImaginaryPart(realPart float64, imaginaryPart float64) IMPSGraphTensor
	// Creates a complex constant operation and returns the result tensor.
	ConstantWithRealPartImaginaryPartDataType(realPart float64, imaginaryPart float64, dataType uint32) IMPSGraphTensor
	// Creates a complex constant op with a given shape and returns the result tensor.
	ConstantWithRealPartImaginaryPartShapeDataType(realPart float64, imaginaryPart float64, shape foundation.NSArray, dataType uint32) IMPSGraphTensor
	// Returns a complex tensor from the two input tensors.
	ComplexTensorWithRealTensorImaginaryTensorName(realTensor IMPSGraphTensor, imaginaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a concatenation operation and returns the result tensor.
	ConcatTensorWithTensorDimensionName(tensor IMPSGraphTensor, tensor2 IMPSGraphTensor, dimensionIndex int, name string) IMPSGraphTensor
	// Creates a concatenation operation and returns the result tensor.
	ConcatTensorsDimensionInterleaveName(tensors []MPSGraphTensor, dimensionIndex int, interleave bool, name string) IMPSGraphTensor
	// Creates a concatenation operation and returns the result tensor.
	ConcatTensorsDimensionName(tensors []MPSGraphTensor, dimensionIndex int, name string) IMPSGraphTensor
	// Returns the complex conjugate of the input tensor elements.
	ConjugateWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a constant operation and returns the result tensor.
	ConstantWithScalarDataType(scalar float64, dataType uint32) IMPSGraphTensor
	// Creates a constant op with a given shape and returns the result tensor.
	ConstantWithScalarShapeDataType(scalar float64, shape foundation.NSArray, dataType uint32) IMPSGraphTensor
	// Creates a constant op with a given shape and data, and returns the result tensor.
	ConstantWithDataShapeDataType(data foundation.NSData, shape foundation.NSArray, dataType uint32) IMPSGraphTensor
	// Creates a 2D (forward) convolution operation and returns the result tensor.
	Convolution2DWithSourceTensorWeightsTensorDescriptorName(source IMPSGraphTensor, weights IMPSGraphTensor, descriptor IMPSGraphConvolution2DOpDescriptor, name string) IMPSGraphTensor
	// Creates a 2D convolution gradient operation with respect to the source tensor of the forward convolution.
	Convolution2DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeForwardConvolutionDescriptorName(incomingGradient IMPSGraphTensor, weights IMPSGraphTensor, outputShape foundation.NSArray, forwardConvolutionDescriptor IMPSGraphConvolution2DOpDescriptor, name string) IMPSGraphTensor
	// Creates a 2D convolution gradient operation with respect to the source tensor of the forward convolution.
	Convolution2DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeTensorForwardConvolutionDescriptorName(gradient IMPSGraphTensor, weights IMPSGraphTensor, outputShapeTensor IMPSGraphTensor, forwardConvolutionDescriptor IMPSGraphConvolution2DOpDescriptor, name string) IMPSGraphTensor
	// Creates a 2D convolution gradient operation with respect to the weights tensor of the forward convolution.
	Convolution2DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeForwardConvolutionDescriptorName(incomingGradient IMPSGraphTensor, source IMPSGraphTensor, outputShape foundation.NSArray, forwardConvolutionDescriptor IMPSGraphConvolution2DOpDescriptor, name string) IMPSGraphTensor
	// Creates a 2D convolution gradient operation with respect to weights tensor of forward convolution.
	Convolution2DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeTensorForwardConvolutionDescriptorName(gradient IMPSGraphTensor, source IMPSGraphTensor, outputShapeTensor IMPSGraphTensor, forwardConvolutionDescriptor IMPSGraphConvolution2DOpDescriptor, name string) IMPSGraphTensor
	// Creates a 3D forward convolution operation and returns the result tensor.
	Convolution3DWithSourceTensorWeightsTensorDescriptorName(source IMPSGraphTensor, weights IMPSGraphTensor, descriptor IMPSGraphConvolution3DOpDescriptor, name string) IMPSGraphTensor
	// Creates a 3D convolution gradient operation with respect to the source tensor of the forward convolution.
	Convolution3DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeForwardConvolutionDescriptorName(incomingGradient IMPSGraphTensor, weights IMPSGraphTensor, outputShape foundation.NSArray, forwardConvolutionDescriptor IMPSGraphConvolution3DOpDescriptor, name string) IMPSGraphTensor
	// Creates a 3D convolution gradient operation with respect to the source tensor of the forward convolution.
	Convolution3DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeTensorForwardConvolutionDescriptorName(gradient IMPSGraphTensor, weights IMPSGraphTensor, outputShapeTensor IMPSGraphTensor, forwardConvolutionDescriptor IMPSGraphConvolution3DOpDescriptor, name string) IMPSGraphTensor
	// Creates a 3D convolution gradient operation with respect to the weights tensor of the forward convolution.
	Convolution3DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeForwardConvolutionDescriptorName(incomingGradient IMPSGraphTensor, source IMPSGraphTensor, outputShape foundation.NSArray, forwardConvolutionDescriptor IMPSGraphConvolution3DOpDescriptor, name string) IMPSGraphTensor
	// Creates a 3D convolution gradient operation with respect to the weights tensor of the forward convolution.
	Convolution3DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeTensorForwardConvolutionDescriptorName(gradient IMPSGraphTensor, source IMPSGraphTensor, outputShapeTensor IMPSGraphTensor, forwardConvolutionDescriptor IMPSGraphConvolution3DOpDescriptor, name string) IMPSGraphTensor
	// Creates a convolution transpose operation and returns the result tensor.
	ConvolutionTranspose2DWithSourceTensorWeightsTensorOutputShapeDescriptorName(source IMPSGraphTensor, weights IMPSGraphTensor, outputShape foundation.NSArray, descriptor IMPSGraphConvolution2DOpDescriptor, name string) IMPSGraphTensor
	// Creates a convolution transpose operation and returns the result tensor.
	ConvolutionTranspose2DWithSourceTensorWeightsTensorOutputShapeTensorDescriptorName(source IMPSGraphTensor, weights IMPSGraphTensor, outputShape IMPSGraphTensor, descriptor IMPSGraphConvolution2DOpDescriptor, name string) IMPSGraphTensor
	// Creates a convolution transpose gradient operation with respect to the source tensor of convolution transpose operation and returns the result tensor.
	ConvolutionTranspose2DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeForwardConvolutionDescriptorName(incomingGradient IMPSGraphTensor, weights IMPSGraphTensor, outputShape foundation.NSArray, forwardConvolutionDescriptor IMPSGraphConvolution2DOpDescriptor, name string) IMPSGraphTensor
	// Creates a convolution transpose gradient operation with respect to the source tensor of convolution transpose operation and returns the result tensor.
	ConvolutionTranspose2DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeTensorForwardConvolutionDescriptorName(incomingGradient IMPSGraphTensor, weights IMPSGraphTensor, outputShape IMPSGraphTensor, forwardConvolutionDescriptor IMPSGraphConvolution2DOpDescriptor, name string) IMPSGraphTensor
	// Creates a convolution transpose gradient operation with respect to the weights tensor of the convolution transpose operation and returns the result tensor.
	ConvolutionTranspose2DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeForwardConvolutionDescriptorName(incomingGradientTensor IMPSGraphTensor, source IMPSGraphTensor, outputShape foundation.NSArray, forwardConvolutionDescriptor IMPSGraphConvolution2DOpDescriptor, name string) IMPSGraphTensor
	// Creates a convolution transpose gradient operation with respect to the weights tensor of the convolution transpose operation and returns the result tensor.
	ConvolutionTranspose2DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeTensorForwardConvolutionDescriptorName(incomingGradientTensor IMPSGraphTensor, source IMPSGraphTensor, outputShape IMPSGraphTensor, forwardConvolutionDescriptor IMPSGraphConvolution2DOpDescriptor, name string) IMPSGraphTensor
	// Creates a get-coordindate operation and returns the result tensor.
	CoordinateAlongAxisWithShapeName(axis int, shape foundation.NSArray, name string) IMPSGraphTensor
	// Creates a get-coordindate operation and returns the result tensor.
	CoordinateAlongAxisWithShapeTensorName(axis int, shapeTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a get-coordindate operation and returns the result tensor.
	CoordinateAlongAxisTensorWithShapeName(axisTensor IMPSGraphTensor, shape foundation.NSArray, name string) IMPSGraphTensor
	// Creates a get-coordindate operation and returns the result tensor.
	CoordinateAlongAxisTensorWithShapeTensorName(axisTensor IMPSGraphTensor, shapeTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Applies the cosine operation to the input tensor elements.
	CosWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Applies the hyperbolic cosine operation to the input tensor elements.
	CoshWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Computes the cumulative maximum of the input tensor along the specified axis.
	CumulativeMaximumWithTensorAxisExclusiveReverseName(tensor IMPSGraphTensor, axis int, exclusive bool, reverse bool, name string) IMPSGraphTensor
	// Computes the cumulative maximum of the input tensor along the specified axis.
	CumulativeMaximumWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor
	// Computes the cumulative maximum of the input tensor along the specified axis.
	CumulativeMaximumWithTensorAxisTensorExclusiveReverseName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, exclusive bool, reverse bool, name string) IMPSGraphTensor
	// Computes the cumulative maximum of the input tensor along the specified axis.
	CumulativeMaximumWithTensorAxisTensorName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Computes the cumulative minimum of the input tensor along the specified axis.
	CumulativeMinimumWithTensorAxisExclusiveReverseName(tensor IMPSGraphTensor, axis int, exclusive bool, reverse bool, name string) IMPSGraphTensor
	// Computes the cumulative minimum of the input tensor along the specified axis.
	CumulativeMinimumWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor
	// Computes the cumulative minimum of the input tensor along the specified axis.
	CumulativeMinimumWithTensorAxisTensorExclusiveReverseName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, exclusive bool, reverse bool, name string) IMPSGraphTensor
	// Computes the cumulative minimum of the input tensor along the specified axis.
	CumulativeMinimumWithTensorAxisTensorName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Computes the cumulative product of the input tensor along the specified axis.
	CumulativeProductWithTensorAxisExclusiveReverseName(tensor IMPSGraphTensor, axis int, exclusive bool, reverse bool, name string) IMPSGraphTensor
	// Computes the cumulative product of the input tensor along the specified axis.
	CumulativeProductWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor
	// Computes the cumulative product of the input tensor along the specified axis.
	CumulativeProductWithTensorAxisTensorExclusiveReverseName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, exclusive bool, reverse bool, name string) IMPSGraphTensor
	// Computes the cumulative product of the input tensor along the specified axis.
	CumulativeProductWithTensorAxisTensorName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Computes the cumulative sum of the input tensor along the specified axis.
	CumulativeSumWithTensorAxisExclusiveReverseName(tensor IMPSGraphTensor, axis int, exclusive bool, reverse bool, name string) IMPSGraphTensor
	// Computes the cumulative sum of the input tensor along the specified axis.
	CumulativeSumWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor
	// Computes the cumulative sum of the input tensor along the specified axis.
	CumulativeSumWithTensorAxisTensorExclusiveReverseName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, exclusive bool, reverse bool, name string) IMPSGraphTensor
	// Computes the cumulative sum of the input tensor along the specified axis.
	CumulativeSumWithTensorAxisTensorName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a depth-to-space2D operation and returns the result tensor.
	DepthToSpace2DTensorWidthAxisHeightAxisDepthAxisBlockSizeUsePixelShuffleOrderName(tensor IMPSGraphTensor, widthAxis uint, heightAxis uint, depthAxis uint, blockSize uint, usePixelShuffleOrder bool, name string) IMPSGraphTensor
	// Creates a depth-to-space2D operation and returns the result tensor.
	DepthToSpace2DTensorWidthAxisTensorHeightAxisTensorDepthAxisTensorBlockSizeUsePixelShuffleOrderName(tensor IMPSGraphTensor, widthAxisTensor IMPSGraphTensor, heightAxisTensor IMPSGraphTensor, depthAxisTensor IMPSGraphTensor, blockSize uint, usePixelShuffleOrder bool, name string) IMPSGraphTensor
	// Creates a 2D-depthwise convolution operation and returns the result tensor.
	DepthwiseConvolution2DWithSourceTensorWeightsTensorDescriptorName(source IMPSGraphTensor, weights IMPSGraphTensor, descriptor IMPSGraphDepthwiseConvolution2DOpDescriptor, name string) IMPSGraphTensor
	// Creates a 2D-depthwise convolution gradient for data operation and returns the result tensor.
	DepthwiseConvolution2DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeDescriptorName(incomingGradient IMPSGraphTensor, weights IMPSGraphTensor, outputShape foundation.NSArray, descriptor IMPSGraphDepthwiseConvolution2DOpDescriptor, name string) IMPSGraphTensor
	// Creates a 2D-depthwise convolution gradient for weights operation and returns the result tensor.
	DepthwiseConvolution2DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeDescriptorName(incomingGradient IMPSGraphTensor, source IMPSGraphTensor, outputShape foundation.NSArray, descriptor IMPSGraphDepthwiseConvolution2DOpDescriptor, name string) IMPSGraphTensor
	// Creates a 3D depthwise convolution operation and returns the result tensor.
	DepthwiseConvolution3DWithSourceTensorWeightsTensorDescriptorName(source IMPSGraphTensor, weights IMPSGraphTensor, descriptor IMPSGraphDepthwiseConvolution3DOpDescriptor, name string) IMPSGraphTensor
	// Creates a 3D depthwise convolution gradient for data operation and returns the result tensor.
	DepthwiseConvolution3DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeDescriptorName(incomingGradient IMPSGraphTensor, weights IMPSGraphTensor, outputShape foundation.NSArray, descriptor IMPSGraphDepthwiseConvolution3DOpDescriptor, name string) IMPSGraphTensor
	// Creates a 3D depthwise convolution gradient for weights operation and returns the result tensor.
	DepthwiseConvolution3DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeDescriptorName(incomingGradient IMPSGraphTensor, source IMPSGraphTensor, outputShape foundation.NSArray, descriptor IMPSGraphDepthwiseConvolution3DOpDescriptor, name string) IMPSGraphTensor
	// Creates a vector lookup-table based quantization operation and returns the result tensor.
	DequantizeTensorLUTTensorAxisName(tensor IMPSGraphTensor, LUTTensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor
	// Creates a lookup-table based quantization operation and returns the result tensor.
	DequantizeTensorLUTTensorName(tensor IMPSGraphTensor, LUTTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates Dequantize operation and returns the result tensor.
	DequantizeTensorScaleZeroPointDataTypeName(tensor IMPSGraphTensor, scale float64, zeroPoint float64, dataType uint32, name string) IMPSGraphTensor
	// Creates a dequantize operation and returns the result tensor.
	DequantizeTensorScaleTensorDataTypeName(tensor IMPSGraphTensor, scaleTensor IMPSGraphTensor, dataType uint32, name string) IMPSGraphTensor
	// Creates Dequantize operation and returns the result tensor.
	DequantizeTensorScaleTensorZeroPointDataTypeAxisName(tensor IMPSGraphTensor, scaleTensor IMPSGraphTensor, zeroPoint float64, dataType uint32, axis int, name string) IMPSGraphTensor
	// Creates a dequantize operation and returns the result tensor.
	DequantizeTensorScaleTensorZeroPointTensorDataTypeAxisName(tensor IMPSGraphTensor, scaleTensor IMPSGraphTensor, zeroPointTensor IMPSGraphTensor, dataType uint32, axis int, name string) IMPSGraphTensor
	// Creates a dequantize operation and returns the result tensor.
	DequantizeTensorScaleTensorZeroPointTensorDataTypeName(tensor IMPSGraphTensor, scaleTensor IMPSGraphTensor, zeroPointTensor IMPSGraphTensor, dataType uint32, name string) IMPSGraphTensor
	// Divides the first input tensor by the second.
	DivisionWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Divides the first input tensor by the second, with the result being 0 if the denominator is 0.
	DivisionNoNaNWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a dropout operation and returns the result
	DropoutTensorRateTensorName(tensor IMPSGraphTensor, rate IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a dropout operation and returns the result
	DropoutTensorRateName(tensor IMPSGraphTensor, rate float64, name string) IMPSGraphTensor
	// Encodes the graph for the given feeds to returns the target tensor values in the results dictionary provided by the user.
	EncodeToCommandBufferFeedsTargetOperationsResultsDictionaryExecutionDescriptor(commandBuffer *metalperformanceshaders.MPSCommandBuffer, feeds MPSGraphTensorDataDictionary, targetOperations []MPSGraphOperation, resultsDictionary MPSGraphTensorDataDictionary, executionDescriptor IMPSGraphExecutionDescriptor)
	// Encodes the graph for the given feeds to returns the target tensor values, ensuring all target operations also executed.
	EncodeToCommandBufferFeedsTargetTensorsTargetOperationsExecutionDescriptor(commandBuffer *metalperformanceshaders.MPSCommandBuffer, feeds MPSGraphTensorDataDictionary, targetTensors []MPSGraphTensor, targetOperations []MPSGraphOperation, executionDescriptor IMPSGraphExecutionDescriptor) MPSGraphTensorDataDictionary
	// Returns the elementwise equality check of the input tensors.
	EqualWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Applies the error function to the input tensor elements.
	ErfWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates an expand-dimensions operation and returns the result tensor.
	ExpandDimsOfTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor
	// Creates an expand-dimensions operation and returns the result tensor.
	ExpandDimsOfTensorAxesTensorName(tensor IMPSGraphTensor, axesTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates an expand-dimensions operation and returns the result tensor.
	ExpandDimsOfTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor
	// Applies the natural exponent to the input tensor elements.
	ExponentWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Applies an exponent with base 10 to the input tensor elements.
	ExponentBase10WithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Applies an exponent with base 2 to the input tensor elements.
	ExponentBase2WithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a fast Fourier transform operation and returns the result tensor.
	FastFourierTransformWithTensorAxesDescriptorName(tensor IMPSGraphTensor, axes []foundation.NSNumber, descriptor IMPSGraphFFTDescriptor, name string) IMPSGraphTensor
	// Creates a fast Fourier transform operation and returns the result tensor.
	FastFourierTransformWithTensorAxesTensorDescriptorName(tensor IMPSGraphTensor, axesTensor IMPSGraphTensor, descriptor IMPSGraphFFTDescriptor, name string) IMPSGraphTensor
	// Creates a flatten2D operation and returns the result tensor.
	Flatten2DTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor
	// Creates a flatten2D operation and returns the result tensor.
	Flatten2DTensorAxisTensorName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Applies the floor operation to the input tensor elements.
	FloorWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Returns the remainder of floor divison between the primary and secondary tensor.
	FloorModuloWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a Gather operation and returns the result tensor.
	GatherWithUpdatesTensorIndicesTensorAxisBatchDimensionsName(updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, axis uint, batchDimensions uint, name string) IMPSGraphTensor
	// Creates a GatherAlongAxis operation and returns the result tensor.
	GatherAlongAxisWithUpdatesTensorIndicesTensorName(axis int, updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a GatherAlongAxis operation and returns the result tensor.
	GatherAlongAxisTensorWithUpdatesTensorIndicesTensorName(axisTensor IMPSGraphTensor, updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a GatherND operation and returns the result tensor.
	GatherNDWithUpdatesTensorIndicesTensorBatchDimensionsName(updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, batchDimensions uint, name string) IMPSGraphTensor
	// Calculates a partial derivative of primaryTensor with respect to the tensors.
	GradientForPrimaryTensorWithTensorsName(primaryTensor IMPSGraphTensor, tensors []MPSGraphTensor, name string) foundation.INSDictionary
	// Checks in an elementwise manner if the first input tensor is greater than the second.
	GreaterThanWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Checks in an elementwise manner if the first input tensor is greater than or equal to the second.
	GreaterThanOrEqualToWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Copies the input tensor values into the output, behaving as an identity operation.
	IdentityWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates an imToCol operation and returns the result tensor.
	ImToColWithSourceTensorDescriptorName(source IMPSGraphTensor, descriptor IMPSGraphImToColOpDescriptor, name string) IMPSGraphTensor
	// Returns the imaginary part of a tensor.
	ImaginaryPartOfTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Computes the inverse of an input tensor.
	InverseOfTensorName(inputTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Checks if the input tensor elements are finite or not.
	IsFiniteWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Checks if the input tensor elements are infinite or not.
	IsInfiniteWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Checks if the input tensor elements are [NaN] or not.
	IsNaNWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Computes the leaky rectified linear unit (ReLU) activation function on the input tensor.
	LeakyReLUWithTensorAlphaName(tensor IMPSGraphTensor, alpha float64, name string) IMPSGraphTensor
	// Computes the leaky rectified linear unit (ReLU) activation function on the input tensor.
	LeakyReLUWithTensorAlphaTensorName(tensor IMPSGraphTensor, alphaTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Computes the gradient of the leaky rectified linear unit (ReLU) activation.
	LeakyReLUGradientWithIncomingGradientSourceTensorAlphaTensorName(gradient IMPSGraphTensor, source IMPSGraphTensor, alphaTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Checks in an elementwise manner if the first input tensor is less than the second.
	LessThanWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Checks in an elementwise manner if the first input tensor is less than or equal to the second.
	LessThanOrEqualToWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Computes the natural logarithm to the input tensor elements.
	LogarithmWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Computes the logarithm with base 10 to the input tensor elements.
	LogarithmBase10WithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Computes the logarithm with base 2 to the input tensor elements.
	LogarithmBase2WithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Returns the elementwise logical AND of the input tensors.
	LogicalANDWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Returns the elementwise logical NAND of the input tensors.
	LogicalNANDWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Returns the elementwise logical NOR of the input tensors.
	LogicalNORWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Returns the elementwise logical OR of the input tensors.
	LogicalORWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Returns the elementwise logical XNOR of the input tensors.
	LogicalXNORWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Returns the elementwise logical XOR of the input tensors.
	LogicalXORWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Computes the matrix multiplication of 2 input tensors with support for broadcasting.
	MatrixMultiplicationWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a 2D max-pooling operation and returns the result tensor.
	MaxPooling2DWithSourceTensorDescriptorName(source IMPSGraphTensor, descriptor IMPSGraphPooling2DOpDescriptor, name string) IMPSGraphTensor
	// Creates a max-pooling gradient operation and returns the result tensor.
	MaxPooling2DGradientWithGradientTensorIndicesTensorOutputShapeDescriptorName(gradient IMPSGraphTensor, indices IMPSGraphTensor, outputShape foundation.NSArray, descriptor IMPSGraphPooling2DOpDescriptor, name string) IMPSGraphTensor
	// Creates a max-pooling gradient operation and returns the result tensor.
	MaxPooling2DGradientWithGradientTensorIndicesTensorOutputShapeTensorDescriptorName(gradient IMPSGraphTensor, indices IMPSGraphTensor, outputShape IMPSGraphTensor, descriptor IMPSGraphPooling2DOpDescriptor, name string) IMPSGraphTensor
	// Creates a max-pooling gradient operation and returns the result tensor.
	MaxPooling2DGradientWithGradientTensorSourceTensorDescriptorName(gradient IMPSGraphTensor, source IMPSGraphTensor, descriptor IMPSGraphPooling2DOpDescriptor, name string) IMPSGraphTensor
	// Creates a 2D max-pooling operation and returns the result tensor and the corresponding indices tensor.
	MaxPooling2DReturnIndicesWithSourceTensorDescriptorName(source IMPSGraphTensor, descriptor IMPSGraphPooling2DOpDescriptor, name string) []MPSGraphTensor
	// Creates a 4D max-pooling operation and returns the result tensor.
	MaxPooling4DWithSourceTensorDescriptorName(source IMPSGraphTensor, descriptor IMPSGraphPooling4DOpDescriptor, name string) IMPSGraphTensor
	// Creates a max-pooling gradient operation and returns the result tensor.
	MaxPooling4DGradientWithGradientTensorSourceTensorDescriptorName(gradient IMPSGraphTensor, source IMPSGraphTensor, descriptor IMPSGraphPooling4DOpDescriptor, name string) IMPSGraphTensor
	// Creates a max-pooling gradient operation and returns the result tensor.
	MaxPooling4DGradientWithGradientTensorIndicesTensorOutputShapeDescriptorName(gradient IMPSGraphTensor, indices IMPSGraphTensor, outputShape foundation.NSArray, descriptor IMPSGraphPooling4DOpDescriptor, name string) IMPSGraphTensor
	// Creates a max-pooling gradient operation and returns the result tensor.
	MaxPooling4DGradientWithGradientTensorIndicesTensorOutputShapeTensorDescriptorName(gradient IMPSGraphTensor, indices IMPSGraphTensor, outputShape IMPSGraphTensor, descriptor IMPSGraphPooling4DOpDescriptor, name string) IMPSGraphTensor
	// Creates a 4D max-pooling operation and returns the result tensor and the corresponding indices tensor.
	MaxPooling4DReturnIndicesWithSourceTensorDescriptorName(source IMPSGraphTensor, descriptor IMPSGraphPooling4DOpDescriptor, name string) []MPSGraphTensor
	// Returns the elementwise maximum of the input tensors.
	MaximumWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Returns the elementwise maximum of the input tensors, while propagating [NaN] values.
	MaximumWithNaNPropagationWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Returns the mean of the first input along the specified axes.
	MeanOfTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor
	// Returns the elementwise minimum of the input tensors.
	MinimumWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Returns the elementwise minimum of the input tensors, while propagating [NaN] values.
	MinimumWithNaNPropagationWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Returns the remainder obtained by dividing the first input tensor by the second.
	ModuloWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Multiplies two input tensors.
	MultiplicationWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Applies negative to the input tensor elements.
	NegativeWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a nonMaximumumSuppression operation and returns the result tensor.
	NonMaximumSuppressionWithBoxesTensorScoresTensorClassIndicesTensorIOUThresholdScoreThresholdPerClassSuppressionCoordinateModeName(boxesTensor IMPSGraphTensor, scoresTensor IMPSGraphTensor, classIndicesTensor IMPSGraphTensor, IOUThreshold float32, scoreThreshold float32, perClassSuppression bool, coordinateMode MPSGraphNonMaximumSuppressionCoordinateMode, name string) IMPSGraphTensor
	// Creates a nonMaximumumSuppression operation and returns the result tensor.
	NonMaximumSuppressionWithBoxesTensorScoresTensorIOUThresholdScoreThresholdPerClassSuppressionCoordinateModeName(boxesTensor IMPSGraphTensor, scoresTensor IMPSGraphTensor, IOUThreshold float32, scoreThreshold float32, perClassSuppression bool, coordinateMode MPSGraphNonMaximumSuppressionCoordinateMode, name string) IMPSGraphTensor
	// Computes the indices of the non-zero elements of the input tensor.
	NonZeroIndicesOfTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a normalization beta-gradient operation and returns the result tensor.
	NormalizationBetaGradientWithIncomingGradientTensorSourceTensorReductionAxesName(incomingGradientTensor IMPSGraphTensor, sourceTensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor
	// Creates a normalization gamma-gradient operation and returns the result tensor.
	NormalizationGammaGradientWithIncomingGradientTensorSourceTensorMeanTensorVarianceTensorReductionAxesEpsilonName(incomingGradientTensor IMPSGraphTensor, sourceTensor IMPSGraphTensor, meanTensor IMPSGraphTensor, varianceTensor IMPSGraphTensor, axes []foundation.NSNumber, epsilon float32, name string) IMPSGraphTensor
	// Creates a normalization input gradient operation and returns the result tensor.
	NormalizationGradientWithIncomingGradientTensorSourceTensorMeanTensorVarianceTensorGammaTensorGammaGradientTensorBetaGradientTensorReductionAxesEpsilonName(incomingGradientTensor IMPSGraphTensor, sourceTensor IMPSGraphTensor, meanTensor IMPSGraphTensor, varianceTensor IMPSGraphTensor, gamma IMPSGraphTensor, gammaGradient IMPSGraphTensor, betaGradient IMPSGraphTensor, axes []foundation.NSNumber, epsilon float32, name string) IMPSGraphTensor
	// Creates a batch normalization operation and returns the result tensor.
	NormalizationWithTensorMeanTensorVarianceTensorGammaTensorBetaTensorEpsilonName(tensor IMPSGraphTensor, mean IMPSGraphTensor, variance IMPSGraphTensor, gamma IMPSGraphTensor, beta IMPSGraphTensor, epsilon float32, name string) IMPSGraphTensor
	// Applies the logical NOT operation to the input tensor elements.
	NotWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Returns the elementwise inequality check of the input tensors.
	NotEqualWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a oneHot operation and returns the result tensor.
	OneHotWithIndicesTensorDepthAxisDataTypeName(indicesTensor IMPSGraphTensor, depth uint, axis uint, dataType uint32, name string) IMPSGraphTensor
	// Creates a oneHot operation and returns the result tensor.
	OneHotWithIndicesTensorDepthAxisDataTypeOnValueOffValueName(indicesTensor IMPSGraphTensor, depth uint, axis uint, dataType uint32, onValue float64, offValue float64, name string) IMPSGraphTensor
	// Creates a oneHot operation and returns the result tensor.
	OneHotWithIndicesTensorDepthAxisName(indicesTensor IMPSGraphTensor, depth uint, axis uint, name string) IMPSGraphTensor
	// Creates a oneHot operation and returns the result tensor.
	OneHotWithIndicesTensorDepthDataTypeName(indicesTensor IMPSGraphTensor, depth uint, dataType uint32, name string) IMPSGraphTensor
	// Creates a oneHot operation and returns the result tensor.
	OneHotWithIndicesTensorDepthDataTypeOnValueOffValueName(indicesTensor IMPSGraphTensor, depth uint, dataType uint32, onValue float64, offValue float64, name string) IMPSGraphTensor
	// Creates a oneHot operation and returns the result tensor.
	OneHotWithIndicesTensorDepthName(indicesTensor IMPSGraphTensor, depth uint, name string) IMPSGraphTensor
	// Creates a padding gradient operation and returns the result tensor.
	PadGradientWithIncomingGradientTensorSourceTensorPaddingModeLeftPaddingRightPaddingName(incomingGradientTensor IMPSGraphTensor, sourceTensor IMPSGraphTensor, paddingMode MPSGraphPaddingMode, leftPadding foundation.NSArray, rightPadding foundation.NSArray, name string) IMPSGraphTensor
	// Creates a padding operation and returns the result tensor.
	PadTensorWithPaddingModeLeftPaddingRightPaddingConstantValueName(tensor IMPSGraphTensor, paddingMode MPSGraphPaddingMode, leftPadding foundation.NSArray, rightPadding foundation.NSArray, constantValue float64, name string) IMPSGraphTensor
	// Creates a placeholder operation and returns the result tensor.
	PlaceholderWithShapeDataTypeName(shape foundation.NSArray, dataType uint32, name string) IMPSGraphTensor
	// Creates a placeholder operation and returns the result tensor with the dataType of the placeholder tensor set to 32 bit float.
	PlaceholderWithShapeName(shape foundation.NSArray, name string) IMPSGraphTensor
	// Returns the elementwise result of raising the first tensor to the power of the second tensor.
	PowerWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a Quantize operation and returns the result tensor.
	QuantizeTensorScaleZeroPointDataTypeName(tensor IMPSGraphTensor, scale float64, zeroPoint float64, dataType uint32, name string) IMPSGraphTensor
	// Creates a Quantize operation and returns the result tensor.
	QuantizeTensorScaleTensorZeroPointDataTypeAxisName(tensor IMPSGraphTensor, scaleTensor IMPSGraphTensor, zeroPoint float64, dataType uint32, axis int, name string) IMPSGraphTensor
	// Creates a Quantize operation and returns the result tensor.
	QuantizeTensorScaleTensorZeroPointTensorDataTypeAxisName(tensor IMPSGraphTensor, scaleTensor IMPSGraphTensor, zeroPointTensor IMPSGraphTensor, dataType uint32, axis int, name string) IMPSGraphTensor
	// Creates a tensor representing state using the Philox algorithm with given counter and key values.
	RandomPhiloxStateTensorWithCounterLowCounterHighKeyName(counterLow uint, counterHigh uint, key uint, name string) IMPSGraphTensor
	// Creates a tensor representing state using the Philox algorithm with given counter and key values.
	RandomPhiloxStateTensorWithSeedName(seed uint, name string) IMPSGraphTensor
	// Creates a Random op of type matching distribution in descriptor and returns random values.
	RandomTensorWithShapeDescriptorName(shape foundation.NSArray, descriptor IMPSGraphRandomOpDescriptor, name string) IMPSGraphTensor
	// Creates a Random op of type matching distribution in descriptor and returns random values.
	RandomTensorWithShapeDescriptorSeedName(shape foundation.NSArray, descriptor IMPSGraphRandomOpDescriptor, seed uint, name string) IMPSGraphTensor
	// Creates a Random op of type matching distribution in descriptor, and returns random values and updated state.
	RandomTensorWithShapeDescriptorStateTensorName(shape foundation.NSArray, descriptor IMPSGraphRandomOpDescriptor, state IMPSGraphTensor, name string) []MPSGraphTensor
	// Creates a Random op of type matching distribution in descriptor and returns random values.
	RandomTensorWithShapeTensorDescriptorName(shapeTensor IMPSGraphTensor, descriptor IMPSGraphRandomOpDescriptor, name string) IMPSGraphTensor
	// Creates a Random op of type matching distribution in descriptor and returns random values.
	RandomTensorWithShapeTensorDescriptorSeedName(shapeTensor IMPSGraphTensor, descriptor IMPSGraphRandomOpDescriptor, seed uint, name string) IMPSGraphTensor
	// Creates a Random op of type matching distribution in descriptor, and returns random values and updated state.
	RandomTensorWithShapeTensorDescriptorStateTensorName(shapeTensor IMPSGraphTensor, descriptor IMPSGraphRandomOpDescriptor, state IMPSGraphTensor, name string) []MPSGraphTensor
	// Creates a RandomUniform operation and returns random uniform values
	RandomUniformTensorWithShapeName(shape foundation.NSArray, name string) IMPSGraphTensor
	// Creates a RandomUniform operation and returns random uniform values
	RandomUniformTensorWithShapeSeedName(shape foundation.NSArray, seed uint, name string) IMPSGraphTensor
	// Creates a RandomUniform operation and returns random uniform values and updated state
	RandomUniformTensorWithShapeStateTensorName(shape foundation.NSArray, state IMPSGraphTensor, name string) []MPSGraphTensor
	// Creates a RandomUniform operation and returns random uniform values
	RandomUniformTensorWithShapeTensorName(shapeTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a RandomUniform operation and returns random uniform values
	RandomUniformTensorWithShapeTensorSeedName(shapeTensor IMPSGraphTensor, seed uint, name string) IMPSGraphTensor
	// Creates a RandomUniform operation and returns random uniform values and updated state
	RandomUniformTensorWithShapeTensorStateTensorName(shapeTensor IMPSGraphTensor, state IMPSGraphTensor, name string) []MPSGraphTensor
	// Computes the ReLU (rectified linear activation unit) function with the input tensor.
	ReLUWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Computes the gradient of the ReLU  (rectified linear activation unit) function using the incoming gradient.
	ReLUGradientWithIncomingGradientSourceTensorName(gradient IMPSGraphTensor, source IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a read op which reads at this point of execution of the graph and returns the result tensor.
	ReadVariableName(variable IMPSGraphTensor, name string) IMPSGraphTensor
	// Returns the real part of a tensor.
	RealPartOfTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a Real-to-Hermitean fast Fourier transform operation and returns the result tensor.
	RealToHermiteanFFTWithTensorAxesDescriptorName(tensor IMPSGraphTensor, axes []foundation.NSNumber, descriptor IMPSGraphFFTDescriptor, name string) IMPSGraphTensor
	// Creates a Real-to-Hermitean fast Fourier transform operation and returns the result tensor.
	RealToHermiteanFFTWithTensorAxesTensorDescriptorName(tensor IMPSGraphTensor, axesTensor IMPSGraphTensor, descriptor IMPSGraphFFTDescriptor, name string) IMPSGraphTensor
	// Applies the reciprocal operation to the input tensor elements.
	ReciprocalWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Applies the reciprocal square root operation to the input tensor elements.
	ReciprocalSquareRootWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a reduction and operation and returns the result tensor.
	ReductionAndWithTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor
	// Creates a reduction and operation and returns the result tensor.
	ReductionAndWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor
	// Creates a reduction argMax operation and returns the result tensor.
	ReductionArgMaximumWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor
	// Creates a reduction argMin operation and returns the result tensor.
	ReductionArgMinimumWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor
	// Creates a reduction max operation and returns the result tensor.
	ReductionMaximumWithTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor
	// Creates a reduction max operation and returns the result tensor.
	ReductionMaximumWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor
	// Creates a reduction max propagate NaN operation and returns the result tensor.
	ReductionMaximumPropagateNaNWithTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor
	// Creates a reduction max propagate NaN operation and returns the result tensor.
	ReductionMaximumPropagateNaNWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor
	// Creates a reduction min operation and returns the result tensor.
	ReductionMinimumWithTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor
	// Creates a reduction minimum operation and returns the result tensor.
	ReductionMinimumWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor
	// Creates a reduction min propagate NaN operation and returns the result tensor.
	ReductionMinimumPropagateNaNWithTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor
	// Creates a reduction min propagate NaN operation and returns the result tensor.
	ReductionMinimumPropagateNaNWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor
	// Creates a reduction or operation and returns the result tensor.
	ReductionOrWithTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor
	// Creates a reduction or operation and returns the result tensor.
	ReductionOrWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor
	// Creates a reduction product operation and returns the result tensor.
	ReductionProductWithTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor
	// Creates a reduction product operation and returns the result tensor.
	ReductionProductWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor
	// Creates a reduction sum operation and returns the result tensor.
	ReductionSumWithTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor
	// Creates a reduction sum operation and returns the result tensor.
	ReductionSumWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor
	// Creates a reinterpret cast operation and returns the result tensor.
	ReinterpretCastTensorToTypeName(tensor IMPSGraphTensor, type_ uint32, name string) IMPSGraphTensor
	// Creates a reshape operation and returns the result tensor.
	ReshapeTensorWithShapeName(tensor IMPSGraphTensor, shape foundation.NSArray, name string) IMPSGraphTensor
	// Creates a reshape operation and returns the result tensor.
	ReshapeTensorWithShapeTensorName(tensor IMPSGraphTensor, shapeTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a Resize operation and returns the result tensor.
	ResizeTensorSizeModeCenterResultAlignCornersLayoutName(imagesTensor IMPSGraphTensor, size foundation.NSArray, mode MPSGraphResizeMode, centerResult bool, alignCorners bool, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor
	// Creates a Resize operation and returns the result tensor.
	ResizeTensorSizeTensorModeCenterResultAlignCornersLayoutName(imagesTensor IMPSGraphTensor, size IMPSGraphTensor, mode MPSGraphResizeMode, centerResult bool, alignCorners bool, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor
	// Creates a Resize operation and returns the result tensor.
	ResizeTensorSizeTensorModeCenterResultAlignCornersName(imagesTensor IMPSGraphTensor, size IMPSGraphTensor, mode MPSGraphResizeMode, centerResult bool, alignCorners bool, name string) IMPSGraphTensor
	// Resamples input images to given size using the provided scale and offset. Destination indices are computed using
	ResizeTensorSizeTensorScaleOffsetTensorModeLayoutName(imagesTensor IMPSGraphTensor, size IMPSGraphTensor, scaleOffset IMPSGraphTensor, mode MPSGraphResizeMode, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor
	// Creates a Resize operation and returns the result tensor.
	ResizeTensorSizeTensorScaleTensorOffsetTensorModeName(imagesTensor IMPSGraphTensor, size IMPSGraphTensor, scale IMPSGraphTensor, offset IMPSGraphTensor, mode MPSGraphResizeMode, name string) IMPSGraphTensor
	// Creates a Resize gradient operation and returns the result tensor.
	ResizeWithGradientTensorInputModeCenterResultAlignCornersLayoutName(gradient IMPSGraphTensor, input IMPSGraphTensor, mode MPSGraphResizeMode, centerResult bool, alignCorners bool, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor
	// Creates a Resize gradient operation and returns the result tensor.
	ResizeWithGradientTensorInputScaleTensorOffsetTensorModeName(gradient IMPSGraphTensor, input IMPSGraphTensor, scale IMPSGraphTensor, offset IMPSGraphTensor, mode MPSGraphResizeMode, name string) IMPSGraphTensor
	// Creates a Resize gradient operation and returns the result tensor.
	ResizeWithGradientTensorInputScaleOffsetTensorModeLayoutName(gradient IMPSGraphTensor, input IMPSGraphTensor, scaleOffset IMPSGraphTensor, mode MPSGraphResizeMode, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor
	// Resamples input images to given size using bilinear sampling.
	ResizeBilinearWithTensorSizeTensorCenterResultAlignCornersLayoutName(imagesTensor IMPSGraphTensor, size IMPSGraphTensor, centerResult bool, alignCorners bool, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor
	// Creates a Resize operation and returns the result tensor.
	ResizeBilinearWithTensorSizeTensorCenterResultAlignCornersName(imagesTensor IMPSGraphTensor, size IMPSGraphTensor, centerResult bool, alignCorners bool, name string) IMPSGraphTensor
	// Resamples input images to given size using the provided scale and offset and bilinear sampling See above discussion for more details.
	ResizeBilinearWithTensorSizeTensorScaleOffsetTensorLayoutName(imagesTensor IMPSGraphTensor, size IMPSGraphTensor, scaleOffset IMPSGraphTensor, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor
	// Creates a Resize operation and returns the result tensor.
	ResizeBilinearWithTensorSizeTensorScaleTensorOffsetTensorName(imagesTensor IMPSGraphTensor, size IMPSGraphTensor, scale IMPSGraphTensor, offset IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a Resize gradient operation and returns the result tensor.
	ResizeBilinearWithGradientTensorInputCenterResultAlignCornersLayoutName(gradient IMPSGraphTensor, input IMPSGraphTensor, centerResult bool, alignCorners bool, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor
	// Creates a Resize gradient operation and returns the result tensor.
	ResizeBilinearWithGradientTensorInputScaleTensorOffsetTensorName(gradient IMPSGraphTensor, input IMPSGraphTensor, scale IMPSGraphTensor, offset IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a Resize gradient operation and returns the result tensor.
	ResizeBilinearWithGradientTensorInputScaleOffsetTensorLayoutName(gradient IMPSGraphTensor, input IMPSGraphTensor, scaleOffset IMPSGraphTensor, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor
	// Resamples input images to given size using nearest neighbor sampling.
	ResizeNearestWithTensorSizeTensorNearestRoundingModeCenterResultAlignCornersLayoutName(imagesTensor IMPSGraphTensor, size IMPSGraphTensor, nearestRoundingMode MPSGraphResizeNearestRoundingMode, centerResult bool, alignCorners bool, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor
	// Creates a Resize operation and returns the result tensor.
	ResizeNearestWithTensorSizeTensorNearestRoundingModeCenterResultAlignCornersName(imagesTensor IMPSGraphTensor, size IMPSGraphTensor, nearestRoundingMode MPSGraphResizeNearestRoundingMode, centerResult bool, alignCorners bool, name string) IMPSGraphTensor
	// Resamples input images to given size using the provided scale and offset and nearest neighbor sampling See above discussion for more details.
	ResizeNearestWithTensorSizeTensorScaleOffsetTensorNearestRoundingModeLayoutName(imagesTensor IMPSGraphTensor, size IMPSGraphTensor, scaleOffset IMPSGraphTensor, nearestRoundingMode MPSGraphResizeNearestRoundingMode, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor
	// Creates a Resize operation and returns the result tensor.
	ResizeNearestWithTensorSizeTensorScaleTensorOffsetTensorNearestRoundingModeName(imagesTensor IMPSGraphTensor, size IMPSGraphTensor, scale IMPSGraphTensor, offset IMPSGraphTensor, nearestRoundingMode MPSGraphResizeNearestRoundingMode, name string) IMPSGraphTensor
	// Creates a Resize gradient operation and returns the result tensor.
	ResizeNearestWithGradientTensorInputNearestRoundingModeCenterResultAlignCornersLayoutName(gradient IMPSGraphTensor, input IMPSGraphTensor, nearestRoundingMode MPSGraphResizeNearestRoundingMode, centerResult bool, alignCorners bool, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor
	// Creates a Resize gradient operation and returns the result tensor.
	ResizeNearestWithGradientTensorInputScaleTensorOffsetTensorNearestRoundingModeName(gradient IMPSGraphTensor, input IMPSGraphTensor, scale IMPSGraphTensor, offset IMPSGraphTensor, nearestRoundingMode MPSGraphResizeNearestRoundingMode, name string) IMPSGraphTensor
	// Creates a Resize gradient operation and returns the result tensor.
	ResizeNearestWithGradientTensorInputScaleOffsetTensorNearestRoundingModeLayoutName(gradient IMPSGraphTensor, input IMPSGraphTensor, scaleOffset IMPSGraphTensor, nearestRoundingMode MPSGraphResizeNearestRoundingMode, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor
	// Creates a reverse operation and returns the result tensor.
	ReverseTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor
	// Creates a reverse operation and returns the result tensor.
	ReverseTensorAxesTensorName(tensor IMPSGraphTensor, axesTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a reverse operation and returns the result tensor.
	ReverseTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Rounds the input tensor elements by rounding to nearest even.
	RintWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Rounds the input tensor elements.
	RoundWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Runs the graph for the given feeds and returns the target tensor values, ensuring all target operations also executed.
	RunWithFeedsTargetTensorsTargetOperations(feeds MPSGraphTensorDataDictionary, targetTensors []MPSGraphTensor, targetOperations []MPSGraphOperation) MPSGraphTensorDataDictionary
	// Runs the graph for the given feeds and returns the target tensor values in the results dictionary provided by the user.
	RunWithMTLCommandQueueFeedsTargetOperationsResultsDictionary(commandQueue metal.MTLCommandQueue, feeds MPSGraphTensorDataDictionary, targetOperations []MPSGraphOperation, resultsDictionary MPSGraphTensorDataDictionary)
	// Runs the graph for the given feeds and returns the target tensor values, ensuring all target operations also executed.
	RunWithMTLCommandQueueFeedsTargetTensorsTargetOperations(commandQueue metal.MTLCommandQueue, feeds MPSGraphTensorDataDictionary, targetTensors []MPSGraphTensor, targetOperations []MPSGraphOperation) MPSGraphTensorDataDictionary
	// Runs the graph for the given feeds and returns the target tensor values, ensuring all target operations also executed.
	RunAsyncWithFeedsTargetTensorsTargetOperationsExecutionDescriptor(feeds MPSGraphTensorDataDictionary, targetTensors []MPSGraphTensor, targetOperations []MPSGraphOperation, executionDescriptor IMPSGraphExecutionDescriptor) MPSGraphTensorDataDictionary
	// Encodes the graph for the given feeds to returns the target tensor values in the results dictionary provided by the user.
	RunAsyncWithMTLCommandQueueFeedsTargetOperationsResultsDictionaryExecutionDescriptor(commandQueue metal.MTLCommandQueue, feeds MPSGraphTensorDataDictionary, targetOperations []MPSGraphOperation, resultsDictionary MPSGraphTensorDataDictionary, executionDescriptor IMPSGraphExecutionDescriptor)
	// Runs the graph for the given feeds and returns the target tensor values, ensuring all target operations also executed.
	RunAsyncWithMTLCommandQueueFeedsTargetTensorsTargetOperationsExecutionDescriptor(commandQueue metal.MTLCommandQueue, feeds MPSGraphTensorDataDictionary, targetTensors []MPSGraphTensor, targetOperations []MPSGraphOperation, executionDescriptor IMPSGraphExecutionDescriptor) MPSGraphTensorDataDictionary
	// Samples a tensor using the coordinates provided, using nearest neighbor sampling with specified rounding mode.
	SampleGridWithSourceTensorCoordinateTensorLayoutNormalizeCoordinatesRelativeCoordinatesAlignCornersPaddingModeNearestRoundingModeConstantValueName(source IMPSGraphTensor, coordinates IMPSGraphTensor, layout MPSGraphTensorNamedDataLayout, normalizeCoordinates bool, relativeCoordinates bool, alignCorners bool, paddingMode MPSGraphPaddingMode, nearestRoundingMode MPSGraphResizeNearestRoundingMode, constantValue float64, name string) IMPSGraphTensor
	// Samples a tensor using the coordinates provided.
	SampleGridWithSourceTensorCoordinateTensorLayoutNormalizeCoordinatesRelativeCoordinatesAlignCornersPaddingModeSamplingModeConstantValueName(source IMPSGraphTensor, coordinates IMPSGraphTensor, layout MPSGraphTensorNamedDataLayout, normalizeCoordinates bool, relativeCoordinates bool, alignCorners bool, paddingMode MPSGraphPaddingMode, samplingMode MPSGraphResizeMode, constantValue float64, name string) IMPSGraphTensor
	// Creates a scaled dot product attention (SDPA) operation and returns the result tensor.
	ScaledDotProductAttentionWithQueryTensorKeyTensorValueTensorMaskTensorScaleName(queryTensor IMPSGraphTensor, keyTensor IMPSGraphTensor, valueTensor IMPSGraphTensor, maskTensor IMPSGraphTensor, scale float32, name string) IMPSGraphTensor
	// Creates a scaled dot product attention (SDPA) operation (without a mask) and returns the result tensor.
	ScaledDotProductAttentionWithQueryTensorKeyTensorValueTensorScaleName(queryTensor IMPSGraphTensor, keyTensor IMPSGraphTensor, valueTensor IMPSGraphTensor, scale float32, name string) IMPSGraphTensor
	// Creates a Scatter operation and returns the result tensor.
	ScatterWithUpdatesTensorIndicesTensorShapeAxisModeName(updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, shape foundation.NSArray, axis int, mode MPSGraphScatterMode, name string) IMPSGraphTensor
	// Creates a ScatterAlongAxis operation and returns the result tensor.
	ScatterAlongAxisWithDataTensorUpdatesTensorIndicesTensorModeName(axis int, dataTensor IMPSGraphTensor, updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, mode MPSGraphScatterMode, name string) IMPSGraphTensor
	// Creates a ScatterAlongAxis operation and returns the result tensor.
	ScatterAlongAxisWithUpdatesTensorIndicesTensorShapeModeName(axis int, updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, shape foundation.NSArray, mode MPSGraphScatterMode, name string) IMPSGraphTensor
	// Creates a ScatterAlongAxis operation and returns the result tensor.
	ScatterAlongAxisTensorWithDataTensorUpdatesTensorIndicesTensorModeName(axisTensor IMPSGraphTensor, dataTensor IMPSGraphTensor, updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, mode MPSGraphScatterMode, name string) IMPSGraphTensor
	// Creates a ScatterAlongAxis operation and returns the result tensor.
	ScatterAlongAxisTensorWithUpdatesTensorIndicesTensorShapeModeName(axisTensor IMPSGraphTensor, updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, shape foundation.NSArray, mode MPSGraphScatterMode, name string) IMPSGraphTensor
	// Creates a ScatterND operation and returns the result tensor.
	ScatterNDWithUpdatesTensorIndicesTensorShapeBatchDimensionsModeName(updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, shape foundation.NSArray, batchDimensions uint, mode MPSGraphScatterMode, name string) IMPSGraphTensor
	// Creates a ScatterND operation and returns the result tensor.
	ScatterNDWithUpdatesTensorIndicesTensorShapeBatchDimensionsName(updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, shape foundation.NSArray, batchDimensions uint, name string) IMPSGraphTensor
	// Creates a ScatterND operation and returns the result tensor.
	ScatterNDWithDataTensorUpdatesTensorIndicesTensorBatchDimensionsModeName(dataTensor IMPSGraphTensor, updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, batchDimensions uint, mode MPSGraphScatterMode, name string) IMPSGraphTensor
	// Creates a Scatter operation and returns the result tensor.
	ScatterWithDataTensorUpdatesTensorIndicesTensorAxisModeName(dataTensor IMPSGraphTensor, updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, axis int, mode MPSGraphScatterMode, name string) IMPSGraphTensor
	// Selects values from either the true or false predicate tensor, depending on the values in the first input.
	SelectWithPredicateTensorTruePredicateTensorFalsePredicateTensorName(predicateTensor IMPSGraphTensor, truePredicateTensor IMPSGraphTensor, falseSelectTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a shape-of operation and returns the result tensor.
	ShapeOfTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Computes the sigmoid operation on an input tensor.
	SigmoidWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Computes the gradient of the sigmoid function using the incoming gradient tensor.
	SigmoidGradientWithIncomingGradientSourceTensorName(gradient IMPSGraphTensor, source IMPSGraphTensor, name string) IMPSGraphTensor
	// Returns the sign of the input tensor elements.
	SignWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Returns the sign bit of the input tensor elements.
	SignbitWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Applies the sine operation to the input tensor elements.
	SinWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a single-gate RNN operation and returns the value and optionally the training state tensor.
	SingleGateRNNWithSourceTensorRecurrentWeightInitStateDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, initState IMPSGraphTensor, descriptor IMPSGraphSingleGateRNNDescriptor, name string) []MPSGraphTensor
	// Creates a single-gate RNN operation and returns the value and optionally the training state tensor.
	SingleGateRNNWithSourceTensorRecurrentWeightInputWeightBiasInitStateDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, descriptor IMPSGraphSingleGateRNNDescriptor, name string) []MPSGraphTensor
	// Creates a single-gate RNN operation and returns the value and optionally the training state tensor.
	SingleGateRNNWithSourceTensorRecurrentWeightInputWeightBiasInitStateMaskDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, mask IMPSGraphTensor, descriptor IMPSGraphSingleGateRNNDescriptor, name string) []MPSGraphTensor
	// Creates a single-gate RNN gradient operation and returns the gradient tensor values.
	SingleGateRNNGradientsWithSourceTensorRecurrentWeightSourceGradientZStateInitStateDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, sourceGradient IMPSGraphTensor, zState IMPSGraphTensor, initState IMPSGraphTensor, descriptor IMPSGraphSingleGateRNNDescriptor, name string) []MPSGraphTensor
	// Creates a single-gate RNN gradient operation and returns the gradient tensor values.
	SingleGateRNNGradientsWithSourceTensorRecurrentWeightSourceGradientZStateInputWeightBiasInitStateDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, sourceGradient IMPSGraphTensor, zState IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, descriptor IMPSGraphSingleGateRNNDescriptor, name string) []MPSGraphTensor
	// Creates a single-gate RNN gradient operation and returns the gradient tensor values.
	SingleGateRNNGradientsWithSourceTensorRecurrentWeightSourceGradientZStateInputWeightBiasInitStateMaskDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, sourceGradient IMPSGraphTensor, zState IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, mask IMPSGraphTensor, descriptor IMPSGraphSingleGateRNNDescriptor, name string) []MPSGraphTensor
	// Creates a single-gate RNN gradient operation and returns the gradient tensor values.
	SingleGateRNNGradientsWithSourceTensorRecurrentWeightSourceGradientZStateStateGradientInputWeightBiasInitStateMaskDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, sourceGradient IMPSGraphTensor, zState IMPSGraphTensor, stateGradient IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, mask IMPSGraphTensor, descriptor IMPSGraphSingleGateRNNDescriptor, name string) []MPSGraphTensor
	// Applies the hyperbolic sine operation to the input tensor elements.
	SinhWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a strided-slice gradient operation and returns the result tensor.
	SliceGradientTensorFwdInShapeTensorStartTensorEndTensorStrideTensorStartMaskEndMaskSqueezeMaskName(inputGradientTensor IMPSGraphTensor, fwdInShapeTensor IMPSGraphTensor, startTensor IMPSGraphTensor, endTensor IMPSGraphTensor, strideTensor IMPSGraphTensor, startMask uint32, endMask uint32, squeezeMask uint32, name string) IMPSGraphTensor
	// Creates a slice gradient operation and returns the result tensor.
	SliceGradientTensorFwdInShapeTensorStartTensorSizeTensorSqueezeMaskName(inputGradientTensor IMPSGraphTensor, fwdInShapeTensor IMPSGraphTensor, startTensor IMPSGraphTensor, sizeTensor IMPSGraphTensor, squeezeMask uint32, name string) IMPSGraphTensor
	// Creates a strided-slice gradient operation and returns the result tensor.
	SliceGradientTensorFwdInShapeTensorStartsEndsStridesName(inputGradientTensor IMPSGraphTensor, fwdInShapeTensor IMPSGraphTensor, starts []foundation.NSNumber, ends []foundation.NSNumber, strides []foundation.NSNumber, name string) IMPSGraphTensor
	// Creates a strided-slice gradient operation and returns the result tensor.
	SliceGradientTensorFwdInShapeTensorStartsEndsStridesStartMaskEndMaskSqueezeMaskName(inputGradientTensor IMPSGraphTensor, fwdInShapeTensor IMPSGraphTensor, starts []foundation.NSNumber, ends []foundation.NSNumber, strides []foundation.NSNumber, startMask uint32, endMask uint32, squeezeMask uint32, name string) IMPSGraphTensor
	// Creates a slice operation and returns the result tensor.
	SliceTensorDimensionStartLengthName(tensor IMPSGraphTensor, dimensionIndex uint, start int, length int, name string) IMPSGraphTensor
	// Creates a strided-slice operation and returns the result tensor.
	SliceTensorStartTensorEndTensorStrideTensorStartMaskEndMaskSqueezeMaskName(tensor IMPSGraphTensor, startTensor IMPSGraphTensor, endTensor IMPSGraphTensor, strideTensor IMPSGraphTensor, startMask uint32, endMask uint32, squeezeMask uint32, name string) IMPSGraphTensor
	// Creates a slice operation and returns the result tensor.
	SliceTensorStartTensorSizeTensorSqueezeMaskName(tensor IMPSGraphTensor, startTensor IMPSGraphTensor, sizeTensor IMPSGraphTensor, squeezeMask uint32, name string) IMPSGraphTensor
	// Creates a strided-slice operation and returns the result tensor.
	SliceTensorStartsEndsStridesName(tensor IMPSGraphTensor, starts []foundation.NSNumber, ends []foundation.NSNumber, strides []foundation.NSNumber, name string) IMPSGraphTensor
	// Creates a strided-slice operation and returns the result tensor.
	SliceTensorStartsEndsStridesStartMaskEndMaskSqueezeMaskName(tensor IMPSGraphTensor, starts []foundation.NSNumber, ends []foundation.NSNumber, strides []foundation.NSNumber, startMask uint32, endMask uint32, squeezeMask uint32, name string) IMPSGraphTensor
	// Creates a strided-slice update operation with zero masks and returns the result tensor.
	SliceUpdateDataTensorUpdateTensorStartsEndsStridesName(dataTensor IMPSGraphTensor, updateTensor IMPSGraphTensor, starts []foundation.NSNumber, ends []foundation.NSNumber, strides []foundation.NSNumber, name string) IMPSGraphTensor
	// Creates a strided-slice update operation and returns the result tensor.
	SliceUpdateDataTensorUpdateTensorStartsEndsStridesStartMaskEndMaskSqueezeMaskName(dataTensor IMPSGraphTensor, updateTensor IMPSGraphTensor, starts []foundation.NSNumber, ends []foundation.NSNumber, strides []foundation.NSNumber, startMask uint32, endMask uint32, squeezeMask uint32, name string) IMPSGraphTensor
	// Creates a strided-slice update operation with zero masks and returns the result tensor.
	SliceUpdateDataTensorUpdateTensorStartsTensorEndsTensorStridesTensorName(dataTensor IMPSGraphTensor, updateTensor IMPSGraphTensor, startsTensor IMPSGraphTensor, endsTensor IMPSGraphTensor, stridesTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a strided-slice update operation and returns the result tensor.
	SliceUpdateDataTensorUpdateTensorStartsTensorEndsTensorStridesTensorStartMaskEndMaskSqueezeMaskName(dataTensor IMPSGraphTensor, updateTensor IMPSGraphTensor, startsTensor IMPSGraphTensor, endsTensor IMPSGraphTensor, stridesTensor IMPSGraphTensor, startMask uint32, endMask uint32, squeezeMask uint32, name string) IMPSGraphTensor
	// Computes the softmax function on the input tensor along the specified axis.
	SoftMaxWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor
	// Creates a softmax cross-entropy loss operation and returns the result tensor.
	SoftMaxCrossEntropyWithSourceTensorLabelsTensorAxisReductionTypeName(sourceTensor IMPSGraphTensor, labelsTensor IMPSGraphTensor, axis int, reductionType MPSGraphLossReductionType, name string) IMPSGraphTensor
	// Creates the gradient of a softmax cross-entropy loss operation and returns the result tensor.
	SoftMaxCrossEntropyGradientWithIncomingGradientTensorSourceTensorLabelsTensorAxisReductionTypeName(gradientTensor IMPSGraphTensor, sourceTensor IMPSGraphTensor, labelsTensor IMPSGraphTensor, axis int, reductionType MPSGraphLossReductionType, name string) IMPSGraphTensor
	// Computes the gradient of the softmax function along the specified axis using the incoming gradient tensor.
	SoftMaxGradientWithIncomingGradientSourceTensorAxisName(gradient IMPSGraphTensor, source IMPSGraphTensor, axis int, name string) IMPSGraphTensor
	// Sorts the elements of the input tensor along the specified axis.
	SortWithTensorAxisDescendingName(tensor IMPSGraphTensor, axis int, descending bool, name string) IMPSGraphTensor
	// Sorts the elements of the input tensor along the specified axis.
	SortWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor
	// Sorts the elements of the input tensor along the specified axis.
	SortWithTensorAxisTensorDescendingName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, descending bool, name string) IMPSGraphTensor
	// Sorts the elements of the input tensor along the specified axis.
	SortWithTensorAxisTensorName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a space-to-depth2D operation and returns the result tensor.
	SpaceToDepth2DTensorWidthAxisHeightAxisDepthAxisBlockSizeUsePixelShuffleOrderName(tensor IMPSGraphTensor, widthAxis uint, heightAxis uint, depthAxis uint, blockSize uint, usePixelShuffleOrder bool, name string) IMPSGraphTensor
	// Creates a space-to-depth2D operation and returns the result tensor.
	SpaceToDepth2DTensorWidthAxisTensorHeightAxisTensorDepthAxisTensorBlockSizeUsePixelShuffleOrderName(tensor IMPSGraphTensor, widthAxisTensor IMPSGraphTensor, heightAxisTensor IMPSGraphTensor, depthAxisTensor IMPSGraphTensor, blockSize uint, usePixelShuffleOrder bool, name string) IMPSGraphTensor
	// Creates a space-to-batch operation and returns the result tensor.
	SpaceToBatchTensorSpatialAxesBatchAxisBlockDimensionsUsePixelShuffleOrderName(tensor IMPSGraphTensor, spatialAxes []foundation.NSNumber, batchAxis int, blockDimensions []foundation.NSNumber, usePixelShuffleOrder bool, name string) IMPSGraphTensor
	// Creates a space-to-batch operation and returns the result tensor.
	SpaceToBatchTensorSpatialAxesTensorBatchAxisTensorBlockDimensionsTensorUsePixelShuffleOrderName(tensor IMPSGraphTensor, spatialAxesTensor IMPSGraphTensor, batchAxisTensor IMPSGraphTensor, blockDimensionsTensor IMPSGraphTensor, usePixelShuffleOrder bool, name string) IMPSGraphTensor
	// Creates a sparse tensor representation.
	SparseTensorWithDescriptorTensorsShapeName(sparseDescriptor IMPSGraphCreateSparseOpDescriptor, inputTensorArray []MPSGraphTensor, shape foundation.NSArray, name string) IMPSGraphTensor
	// Creates a sparse tensor representation.
	SparseTensorWithTypeTensorsShapeDataTypeName(sparseStorageType MPSGraphSparseStorageType, inputTensorArray []MPSGraphTensor, shape foundation.NSArray, dataType uint32, name string) IMPSGraphTensor
	// Creates a split operation and returns the result tensor.
	SplitTensorNumSplitsAxisName(tensor IMPSGraphTensor, numSplits uint, axis int, name string) []MPSGraphTensor
	// Creates a split operation and returns the result tensor.
	SplitTensorSplitSizesAxisName(tensor IMPSGraphTensor, splitSizes []foundation.NSNumber, axis int, name string) []MPSGraphTensor
	// Creates a split operation and returns the result tensor.
	SplitTensorSplitSizesTensorAxisName(tensor IMPSGraphTensor, splitSizesTensor IMPSGraphTensor, axis int, name string) []MPSGraphTensor
	// Applies the square operation to the input tensor elements.
	SquareWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Applies the square root operation to the input tensor elements.
	SquareRootWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a squeeze operation and returns the result tensor.
	SqueezeTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor
	// Creates a squeeze operation and returns the result tensor.
	SqueezeTensorAxesTensorName(tensor IMPSGraphTensor, axesTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a squeeze operation and returns the result tensor.
	SqueezeTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor
	// Creates a squeeze operation and returns the result tensor.
	SqueezeTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a stack operation and returns the result tensor.
	StackTensorsAxisName(inputTensors []MPSGraphTensor, axis int, name string) IMPSGraphTensor
	// Creates a stencil operation and returns the result tensor.
	StencilWithSourceTensorWeightsTensorDescriptorName(source IMPSGraphTensor, weights IMPSGraphTensor, descriptor IMPSGraphStencilOpDescriptor, name string) IMPSGraphTensor
	// The Stochastic gradient descent performs a gradient descent.
	StochasticGradientDescentWithLearningRateTensorValuesTensorGradientTensorName(learningRateTensor IMPSGraphTensor, valuesTensor IMPSGraphTensor, gradientTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Subtracts the second input tensor from the first.
	SubtractionWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Applies the tangent operation to the input tensor elements.
	TanWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Applies the hyperbolic tangent operation to the input tensor elements.
	TanhWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a tile gradient operation and returns the result tensor.
	TileGradientWithIncomingGradientTensorSourceTensorWithMultiplierName(incomingGradientTensor IMPSGraphTensor, sourceTensor IMPSGraphTensor, multiplier foundation.NSArray, name string) IMPSGraphTensor
	// Creates a tile operation and returns the result tensor.
	TileTensorWithMultiplierName(tensor IMPSGraphTensor, multiplier foundation.NSArray, name string) IMPSGraphTensor
	// Creates a TopK operation and returns the value and indices tensors.
	TopKWithSourceTensorAxisKName(source IMPSGraphTensor, axis int, k uint, name string) []MPSGraphTensor
	// Creates a TopK operation and returns the result tensor.
	TopKWithSourceTensorAxisTensorKTensorName(source IMPSGraphTensor, axisTensor IMPSGraphTensor, kTensor IMPSGraphTensor, name string) []MPSGraphTensor
	// Creates a TopK operation and returns the value and indices tensors
	TopKWithSourceTensorKName(source IMPSGraphTensor, k uint, name string) []MPSGraphTensor
	// Creates a TopK operation and returns the result tensor.
	TopKWithSourceTensorKTensorName(source IMPSGraphTensor, kTensor IMPSGraphTensor, name string) []MPSGraphTensor
	// Creates a TopKGradient operation and returns the result tensor.
	TopKWithGradientTensorSourceKName(gradient IMPSGraphTensor, source IMPSGraphTensor, k uint, name string) IMPSGraphTensor
	// Creates a TopKGradient operation and returns the result tensor.
	TopKWithGradientTensorSourceKTensorName(gradient IMPSGraphTensor, source IMPSGraphTensor, kTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a TopKGradient operation and returns the result tensor.
	TopKWithGradientTensorSourceAxisKName(gradient IMPSGraphTensor, source IMPSGraphTensor, axis int, k uint, name string) IMPSGraphTensor
	// Creates a TopKGradient operation and returns the result tensor.
	TopKWithGradientTensorSourceAxisTensorKTensorName(gradient IMPSGraphTensor, source IMPSGraphTensor, axisTensor IMPSGraphTensor, kTensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a permutation operation and returns the result tensor.
	TransposeTensorPermutationName(tensor IMPSGraphTensor, permutation []foundation.NSNumber, name string) IMPSGraphTensor
	// Creates a transpose operation and returns the result tensor.
	TransposeTensorDimensionWithDimensionName(tensor IMPSGraphTensor, dimensionIndex uint, dimensionIndex2 uint, name string) IMPSGraphTensor
	// Applies the truncate operation to the input tensor elements.
	TruncateWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Creates a variable operation and returns the result tensor.
	VariableWithDataShapeDataTypeName(data foundation.NSData, shape foundation.NSArray, dataType uint32, name string) IMPSGraphTensor
	// Creates a variable from an input tensor.
	VariableFromTensorWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor
	// Returns the variance of the first input along the specified axes.
	VarianceOfTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor
	// Returns the variance of the first input along the specified axes when the mean has been precomputed.
	VarianceOfTensorMeanTensorAxesName(tensor IMPSGraphTensor, meanTensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor

	// Creates a scaled dot product attention (SDPA) operation using a descriptor and returns the result tensor.
	ScaledDotProductAttentionWithQueryTensorKeyTensorValueTensorDescriptorName(queryTensor IMPSGraphTensor, keyTensor IMPSGraphTensor, valueTensor IMPSGraphTensor, descriptor IMPSGraphSDPADescriptor, name string) IMPSGraphTensor
}

An interface definition for the MPSGraph class.

Instance Properties

Instance Methods

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph

type IMPSGraphCompilationDescriptor

type IMPSGraphCompilationDescriptor interface {
	IMPSGraphObject

	// The dictionary used during runtime to lookup the [MPSGraphExecutable](<https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutable>) which correspond to the `symbolName`.
	Callables() MPSGraphCallableMap
	SetCallables(value MPSGraphCallableMap)
	// The handler that the graph calls when the compilation completes.
	CompilationCompletionHandler() MPSGraphExecutableErrorHandler
	SetCompilationCompletionHandler(value MPSGraphExecutableErrorHandler)
	// The dispatch queue used for the compilation.
	DispatchQueue() dispatch.Queue
	SetDispatchQueue(value dispatch.Queue)
	// The optimization level for the graph execution, default is MPSGraphOptimizationLevel1.
	OptimizationLevel() MPSGraphOptimization
	SetOptimizationLevel(value MPSGraphOptimization)
	// The optimization profile for the graph optimization.
	OptimizationProfile() MPSGraphOptimizationProfile
	SetOptimizationProfile(value MPSGraphOptimizationProfile)
	// Across the executable allow reduced precision fast math optimizations.
	ReducedPrecisionFastMath() MPSGraphReducedPrecisionFastMath
	SetReducedPrecisionFastMath(value MPSGraphReducedPrecisionFastMath)
	// Flag that makes the compile or specialize call blocking till the entire compilation is complete, defaults to NO.
	WaitForCompilationCompletion() bool
	SetWaitForCompilationCompletion(value bool)

	// Turns off type inference and relies on type inference during runtime.
	DisableTypeInference()
}

An interface definition for the MPSGraphCompilationDescriptor class.

Instance Properties

Instance Methods

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphCompilationDescriptor

type IMPSGraphConvolution2DOpDescriptor

type IMPSGraphConvolution2DOpDescriptor interface {
	IMPSGraphObject

	// The named layout of data in the source tensor.
	DataLayout() MPSGraphTensorNamedDataLayout
	SetDataLayout(value MPSGraphTensorNamedDataLayout)
	// The amount by which the weights tensor expands in the `x`-direction.
	DilationRateInX() uint
	SetDilationRateInX(value uint)
	// The amount by which the weights tensor expands in the `y`-direction.
	DilationRateInY() uint
	SetDilationRateInY(value uint)
	// The number of partitions of the input and output channels.
	Groups() uint
	SetGroups(value uint)
	// The number of zeros added at the bottom of the source tensor.
	PaddingBottom() uint
	SetPaddingBottom(value uint)
	// The number of zeros added on the left side of the source tensor.
	PaddingLeft() uint
	SetPaddingLeft(value uint)
	// The number of zeros added on the right side of the source tensor.
	PaddingRight() uint
	SetPaddingRight(value uint)
	// The type of padding applied to the source tensor.
	PaddingStyle() MPSGraphPaddingStyle
	SetPaddingStyle(value MPSGraphPaddingStyle)
	// The number of zeros added at the top of the source tensor.
	PaddingTop() uint
	SetPaddingTop(value uint)
	// The scale that maps `x`-coordinate of the destination to `x`-coordinate of the source.
	StrideInX() uint
	SetStrideInX(value uint)
	// The scale that maps `y`-coordinate of the destination to `y`-coordinate of the source.
	StrideInY() uint
	SetStrideInY(value uint)
	// The named layout of data in the weights tensor.
	WeightsLayout() MPSGraphTensorNamedDataLayout
	SetWeightsLayout(value MPSGraphTensorNamedDataLayout)

	// Sets the left, right, top, and bottom padding values.
	SetExplicitPaddingWithPaddingLeftPaddingRightPaddingTopPaddingBottom(paddingLeft uint, paddingRight uint, paddingTop uint, paddingBottom uint)
}

An interface definition for the MPSGraphConvolution2DOpDescriptor class.

Instance Properties

Instance Methods

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution2DOpDescriptor

type IMPSGraphConvolution3DOpDescriptor

type IMPSGraphConvolution3DOpDescriptor interface {
	IMPSGraphObject

	// The named layout of data in the source tensor.
	DataLayout() MPSGraphTensorNamedDataLayout
	SetDataLayout(value MPSGraphTensorNamedDataLayout)
	// The amount by which weights tensor expands in the `x`-direction.
	DilationRateInX() uint
	SetDilationRateInX(value uint)
	// The amount by which weights tensor expands in the `y`-direction.
	DilationRateInY() uint
	SetDilationRateInY(value uint)
	// The amount by which weights tensor expands in the `z`-direction.
	DilationRateInZ() uint
	SetDilationRateInZ(value uint)
	// The number of partitions of the input and output channels.
	Groups() uint
	SetGroups(value uint)
	// The number of zeros added at the back of the source tensor.
	PaddingBack() uint
	SetPaddingBack(value uint)
	// The number of zeros added at the bottom of the source tensor.
	PaddingBottom() uint
	SetPaddingBottom(value uint)
	// The number of zeros added at the front of the source tensor.
	PaddingFront() uint
	SetPaddingFront(value uint)
	// The number of zeros added on the left side of the source tensor.
	PaddingLeft() uint
	SetPaddingLeft(value uint)
	// The number of zeros added on the right side of the source tensor.
	PaddingRight() uint
	SetPaddingRight(value uint)
	// The type of padding that is applied to the source tensor.
	PaddingStyle() MPSGraphPaddingStyle
	SetPaddingStyle(value MPSGraphPaddingStyle)
	// The number of zeros added at the top of the source tensor.
	PaddingTop() uint
	SetPaddingTop(value uint)
	// The scale that maps`x`-coordinate of destination to `x`-coordinate of source.
	StrideInX() uint
	SetStrideInX(value uint)
	// The scale that maps`y`-coordinate of destination to `y`-coordinate of source.
	StrideInY() uint
	SetStrideInY(value uint)
	// The scale that maps`z`-coordinate of destination to `z`-coordinate of source.
	StrideInZ() uint
	SetStrideInZ(value uint)
	// The named layout of data in the weights tensor.
	WeightsLayout() MPSGraphTensorNamedDataLayout
	SetWeightsLayout(value MPSGraphTensorNamedDataLayout)

	// Sets the left, right, top, bottom, front, and back padding values.
	SetExplicitPaddingWithPaddingLeftPaddingRightPaddingTopPaddingBottomPaddingFrontPaddingBack(paddingLeft uint, paddingRight uint, paddingTop uint, paddingBottom uint, paddingFront uint, paddingBack uint)
}

An interface definition for the MPSGraphConvolution3DOpDescriptor class.

Instance Properties

Instance Methods

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution3DOpDescriptor

type IMPSGraphCreateSparseOpDescriptor

type IMPSGraphCreateSparseOpDescriptor interface {
	IMPSGraphObject

	// Defines the datatype of the sparse tensor.
	DataType() uint32
	SetDataType(value uint32)
	// Defines the storage format of the sparse tensor.
	SparseStorageType() MPSGraphSparseStorageType
	SetSparseStorageType(value MPSGraphSparseStorageType)
}

An interface definition for the MPSGraphCreateSparseOpDescriptor class.

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphCreateSparseOpDescriptor

type IMPSGraphDepthwiseConvolution2DOpDescriptor

type IMPSGraphDepthwiseConvolution2DOpDescriptor interface {
	IMPSGraphObject

	// The data layout of the input data in the forward pass.
	DataLayout() MPSGraphTensorNamedDataLayout
	SetDataLayout(value MPSGraphTensorNamedDataLayout)
	// The dilation rate for the x dimension.
	DilationRateInX() uint
	SetDilationRateInX(value uint)
	// The dilation rate for the y dimension.
	DilationRateInY() uint
	SetDilationRateInY(value uint)
	// The explicit padding value for the y dimension operation adds after the data.
	PaddingBottom() uint
	SetPaddingBottom(value uint)
	// The explicit padding value for the x dimension the operation adds before the data.
	PaddingLeft() uint
	SetPaddingLeft(value uint)
	// The explicit padding value for the x dimension operation adds after the data.
	PaddingRight() uint
	SetPaddingRight(value uint)
	// The padding style for the operation.
	PaddingStyle() MPSGraphPaddingStyle
	SetPaddingStyle(value MPSGraphPaddingStyle)
	// The explicit padding value for the y dimension operation adds before the data.
	PaddingTop() uint
	SetPaddingTop(value uint)
	// The stride for the x dimension.
	StrideInX() uint
	SetStrideInX(value uint)
	// The stride for the y dimension.
	StrideInY() uint
	SetStrideInY(value uint)
	// The data layout of the weights.
	WeightsLayout() MPSGraphTensorNamedDataLayout
	SetWeightsLayout(value MPSGraphTensorNamedDataLayout)

	// Sets the explicit padding values.
	SetExplicitPaddingWithPaddingLeftPaddingRightPaddingTopPaddingBottom(paddingLeft uint, paddingRight uint, paddingTop uint, paddingBottom uint)
}

An interface definition for the MPSGraphDepthwiseConvolution2DOpDescriptor class.

Instance Properties

Instance Methods

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDepthwiseConvolution2DOpDescriptor

type IMPSGraphDepthwiseConvolution3DOpDescriptor

type IMPSGraphDepthwiseConvolution3DOpDescriptor interface {
	IMPSGraphObject

	// The axis that contains the channels in the input and the weights, within the 4D tile of the last dimensions.
	ChannelDimensionIndex() int
	SetChannelDimensionIndex(value int)
	// The dilation rates for spatial dimensions.
	DilationRates() []foundation.NSNumber
	SetDilationRates(value []foundation.NSNumber)
	// The padding style for the operation.
	PaddingStyle() MPSGraphPaddingStyle
	SetPaddingStyle(value MPSGraphPaddingStyle)
	// The padding values for spatial dimensions.
	PaddingValues() []foundation.NSNumber
	SetPaddingValues(value []foundation.NSNumber)
	// The strides for spatial dimensions.
	Strides() []foundation.NSNumber
	SetStrides(value []foundation.NSNumber)
}

An interface definition for the MPSGraphDepthwiseConvolution3DOpDescriptor class.

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDepthwiseConvolution3DOpDescriptor

type IMPSGraphDevice

type IMPSGraphDevice interface {
	IMPSGraphObject

	// If device type is Metal then returns the corresponding MTLDevice else nil.
	MetalDevice() metal.MTLDevice
	// Device of the MPSGraphDevice.
	Type() MPSGraphDeviceType
}

An interface definition for the MPSGraphDevice class.

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDevice

type IMPSGraphExecutable

type IMPSGraphExecutable interface {
	IMPSGraphObject

	// Initialize the executable with the Core ML model package at the provided URL.
	InitWithCoreMLPackageAtURLCompilationDescriptor(coreMLPackageURL foundation.NSURL, compilationDescriptor IMPSGraphCompilationDescriptor) MPSGraphExecutable
	// Initialize the executable with the Metal Performance Shaders Graph package at the provided URL.
	InitWithMPSGraphPackageAtURLCompilationDescriptor(mpsgraphPackageURL foundation.NSURL, compilationDescriptor IMPSGraphCompilationDescriptor) MPSGraphExecutable

	// Tensors fed to the graph, can be used to order the inputs when executable is created with a graph.
	FeedTensors() []MPSGraphTensor
	// Options for the graph executable.
	Options() MPSGraphOptions
	SetOptions(value MPSGraphOptions)
	// Tensors targeted by the graph, can be used to order the outputs when executable was created with a graph.
	TargetTensors() []MPSGraphTensor

	// Runs the graph for the given feeds and returns the target tensor values, ensuring all target operations also executed. This call is asynchronous and will return immediately after finishing encoding.
	EncodeToCommandBufferInputsArrayResultsArrayExecutionDescriptor(commandBuffer *metalperformanceshaders.MPSCommandBuffer, inputsArray []MPSGraphTensorData, resultsArray []MPSGraphTensorData, executionDescriptor IMPSGraphExecutableExecutionDescriptor) []MPSGraphTensorData
	// Get output shapes for a specialized executable.
	GetOutputTypesWithDeviceInputTypesCompilationDescriptor(device IMPSGraphDevice, inputTypes []MPSGraphType, compilationDescriptor IMPSGraphCompilationDescriptor) []MPSGraphShapedType
	// Runs the graph for the given feeds and returns the target tensor values, ensuring all target operations also executed.
	RunWithMTLCommandQueueInputsArrayResultsArrayExecutionDescriptor(commandQueue metal.MTLCommandQueue, inputsArray []MPSGraphTensorData, resultsArray []MPSGraphTensorData, executionDescriptor IMPSGraphExecutableExecutionDescriptor) []MPSGraphTensorData
	// Runs the graph for the given feeds and returns the target tensor values, ensuring all target operations also executed. This call is asynchronous and will return immediately.
	RunAsyncWithMTLCommandQueueInputsArrayResultsArrayExecutionDescriptor(commandQueue metal.MTLCommandQueue, inputsArray []MPSGraphTensorData, resultsArray []MPSGraphTensorData, executionDescriptor IMPSGraphExecutableExecutionDescriptor) []MPSGraphTensorData
	// Serialize the MPSGraph executable at the provided url.
	SerializeToMPSGraphPackageAtURLDescriptor(url foundation.NSURL, descriptor IMPSGraphExecutableSerializationDescriptor)
	// Specialize the executable and optimize it.
	SpecializeWithDeviceInputTypesCompilationDescriptor(device IMPSGraphDevice, inputTypes []MPSGraphType, compilationDescriptor IMPSGraphCompilationDescriptor)
}

An interface definition for the MPSGraphExecutable class.

Initializers

Instance Properties

Instance Methods

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutable

type IMPSGraphExecutableExecutionDescriptor

type IMPSGraphExecutableExecutionDescriptor interface {
	IMPSGraphObject

	// A notification that appears when graph-executable execution is finished.
	CompletionHandler() MPSGraphTensorDataArrayErrorHandler
	SetCompletionHandler(value MPSGraphTensorDataArrayErrorHandler)
	// A notification that appears when graph-executable execution is scheduled.
	ScheduledHandler() MPSGraphTensorDataArrayErrorHandler
	SetScheduledHandler(value MPSGraphTensorDataArrayErrorHandler)
	// Flag for the graph executable to wait till the execution has completed.
	WaitUntilCompleted() bool
	SetWaitUntilCompleted(value bool)

	// Signals these shared events at execution stage and immediately proceeds.
	SignalEventAtExecutionEventValue(event metal.MTLSharedEvent, executionStage MPSGraphExecutionStage, value uint64)
	// Waits on these shared events before scheduling execution on the HW.
	WaitForEventValue(event metal.MTLSharedEvent, value uint64)
}

An interface definition for the MPSGraphExecutableExecutionDescriptor class.

Instance Properties

Instance Methods

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutableExecutionDescriptor

type IMPSGraphExecutableSerializationDescriptor

type IMPSGraphExecutableSerializationDescriptor interface {
	IMPSGraphObject

	// Flag to append to an existing .mpsgraphpackage if found at provided url.
	Append() bool
	SetAppend(value bool)
	// The deployment platform used to serialize the executable.
	DeploymentPlatform() MPSGraphDeploymentPlatform
	SetDeploymentPlatform(value MPSGraphDeploymentPlatform)
	// The minimum deployment target to serialize the executable.
	MinimumDeploymentTarget() string
	SetMinimumDeploymentTarget(value string)
}

An interface definition for the MPSGraphExecutableSerializationDescriptor class.

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutableSerializationDescriptor

type IMPSGraphExecutionDescriptor

type IMPSGraphExecutionDescriptor interface {
	IMPSGraphObject

	// The compilation descriptor for the graph.
	CompilationDescriptor() IMPSGraphCompilationDescriptor
	SetCompilationDescriptor(value IMPSGraphCompilationDescriptor)
	// The handler that graph calls at the completion of the execution.
	CompletionHandler() MPSGraphCompletionHandler
	SetCompletionHandler(value objc.ID)
	// The handler that graph calls when it schedules the execution.
	ScheduledHandler() MPSGraphScheduledHandler
	SetScheduledHandler(value objc.ID)
	// The flag that blocks the execution call until the entire execution is complete.
	WaitUntilCompleted() bool
	SetWaitUntilCompleted(value bool)

	// Executable signals these shared events at execution stage and immediately proceeds.
	SignalEventAtExecutionEventValue(event metal.MTLSharedEvent, executionStage MPSGraphExecutionStage, value uint64)
	// Executable waits on these shared events before scheduling execution on the HW, this does not include encoding which can still continue.
	WaitForEventValue(event metal.MTLSharedEvent, value uint64)
}

An interface definition for the MPSGraphExecutionDescriptor class.

Instance Properties

Instance Methods

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutionDescriptor

type IMPSGraphFFTDescriptor

type IMPSGraphFFTDescriptor interface {
	IMPSGraphObject

	// A Boolean-valued parameter that defines the phase factor sign for Fourier transforms.
	Inverse() bool
	SetInverse(value bool)
	// A parameter which controls how graph rounds the output tensor size for a Hermitean-to-real Fourier transform.
	RoundToOddHermitean() bool
	SetRoundToOddHermitean(value bool)
	// The scaling mode of the fast fourier transform (FFT) operation.
	ScalingMode() MPSGraphFFTScalingMode
	SetScalingMode(value MPSGraphFFTScalingMode)
}

An interface definition for the MPSGraphFFTDescriptor class.

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphFFTDescriptor

type IMPSGraphGRUDescriptor

type IMPSGraphGRUDescriptor interface {
	IMPSGraphObject

	// A parameter that defines a bidirectional GRU layer.
	Bidirectional() bool
	SetBidirectional(value bool)
	// A parameter that chooses between two variants for the final output computation.
	FlipZ() bool
	SetFlipZ(value bool)
	// A parameter that defines the activation function to use with the output-gate of the GRU operation.
	OutputGateActivation() MPSGraphRNNActivation
	SetOutputGateActivation(value MPSGraphRNNActivation)
	// A parameter that chooses between two variants for the reset gate computation.
	ResetAfter() bool
	SetResetAfter(value bool)
	// A parameter that defines the activation function to use with the reset-gate of the GRU operation.
	ResetGateActivation() MPSGraphRNNActivation
	SetResetGateActivation(value MPSGraphRNNActivation)
	// A parameter that controls the internal order of the GRU gates.
	ResetGateFirst() bool
	SetResetGateFirst(value bool)
	// A parameter that defines the time direction of the input sequence.
	Reverse() bool
	SetReverse(value bool)
	// A parameter that enables the GRU layer to support training.
	Training() bool
	SetTraining(value bool)
	// A parameter that defines the activation function to use with the update-gate of the GRU operation.
	UpdateGateActivation() MPSGraphRNNActivation
	SetUpdateGateActivation(value MPSGraphRNNActivation)
}

An interface definition for the MPSGraphGRUDescriptor class.

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphGRUDescriptor

type IMPSGraphImToColOpDescriptor

type IMPSGraphImToColOpDescriptor interface {
	IMPSGraphObject

	// The property that defines the layout of source or output  tensor. e.g. `batch x channels x width x height` for [NCHW] layout
	DataLayout() MPSGraphTensorNamedDataLayout
	SetDataLayout(value MPSGraphTensorNamedDataLayout)
	// The property that defines the dilation in width dimension.
	DilationRateInX() uint
	SetDilationRateInX(value uint)
	// The property that defines the dilation in height dimension.
	DilationRateInY() uint
	SetDilationRateInY(value uint)
	// The property that defines the kernel size  in height dimension.
	KernelHeight() uint
	SetKernelHeight(value uint)
	// The property that defines the kernel size in width dimension.
	KernelWidth() uint
	SetKernelWidth(value uint)
	// The property that defines the padding in height dimension at the bottom.
	PaddingBottom() uint
	SetPaddingBottom(value uint)
	// The property that defines the padding in width dimension on the left side.
	PaddingLeft() uint
	SetPaddingLeft(value uint)
	// The property that defines the padding in width dimension on the right side.
	PaddingRight() uint
	SetPaddingRight(value uint)
	// The property that defines the padding in height dimension at the top.
	PaddingTop() uint
	SetPaddingTop(value uint)
	// The property that defines the stride in width dimension.
	StrideInX() uint
	SetStrideInX(value uint)
	// The property that defines the stride in height dimension.
	StrideInY() uint
	SetStrideInY(value uint)

	// Sets the descriptor’s padding to the given values.
	SetExplicitPaddingWithPaddingLeftPaddingRightPaddingTopPaddingBottom(paddingLeft uint, paddingRight uint, paddingTop uint, paddingBottom uint)
}

An interface definition for the MPSGraphImToColOpDescriptor class.

Instance Properties

Instance Methods

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphImToColOpDescriptor

type IMPSGraphLSTMDescriptor

type IMPSGraphLSTMDescriptor interface {
	IMPSGraphObject

	// A parameter that defines the activation function used with the current cell value of the LSTM operation.
	Activation() MPSGraphRNNActivation
	SetActivation(value MPSGraphRNNActivation)
	// A parameter that defines a bidirectional LSTM layer.
	Bidirectional() bool
	SetBidirectional(value bool)
	// A parameter that defines the activation function used with the cell gate of the LSTM operation.
	CellGateActivation() MPSGraphRNNActivation
	SetCellGateActivation(value MPSGraphRNNActivation)
	// A parameter that defines the activation function used with the forget gate of the LSTM operation.
	ForgetGateActivation() MPSGraphRNNActivation
	SetForgetGateActivation(value MPSGraphRNNActivation)
	// A parameter that controls the internal order of the LSTM gates.
	ForgetGateLast() bool
	SetForgetGateLast(value bool)
	// A parameter that defines the activation function used with the input gate of the LSTM operation.
	InputGateActivation() MPSGraphRNNActivation
	SetInputGateActivation(value MPSGraphRNNActivation)
	// A parameter that defines the activation function used with the output gate of the LSTM operation.
	OutputGateActivation() MPSGraphRNNActivation
	SetOutputGateActivation(value MPSGraphRNNActivation)
	// A parameter that controls whether or not to return the output cell from the LSTM layer.
	ProduceCell() bool
	SetProduceCell(value bool)
	// A parameter that defines time direction of the input sequence.
	Reverse() bool
	SetReverse(value bool)
	// A parameter that enables the LSTM layer to support training.
	Training() bool
	SetTraining(value bool)
}

An interface definition for the MPSGraphLSTMDescriptor class.

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphLSTMDescriptor

type IMPSGraphObject

type IMPSGraphObject interface {
	objectivec.IObject
}

An interface definition for the MPSGraphObject class.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphObject

type IMPSGraphOperation

type IMPSGraphOperation interface {
	IMPSGraphObject

	// The set of operations guaranteed to execute before this operation.
	ControlDependencies() []MPSGraphOperation
	// The graph on which the operation is defined.
	Graph() IMPSGraph
	// The input tensors of the operation.
	InputTensors() []MPSGraphTensor
	// Name of the operation.
	Name() string
	// The output tensors of the operation.
	OutputTensors() []MPSGraphTensor
}

An interface definition for the MPSGraphOperation class.

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphOperation

type IMPSGraphPooling2DOpDescriptor

type IMPSGraphPooling2DOpDescriptor interface {
	IMPSGraphObject

	// Affects how the graph computes the output size.
	CeilMode() bool
	SetCeilMode(value bool)
	// Defines the data layout of the input data in the forward pass. See: [MPSGraphTensorNamedDataLayout](<https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorNamedDataLayout>).
	DataLayout() MPSGraphTensorNamedDataLayout
	SetDataLayout(value MPSGraphTensorNamedDataLayout)
	// Defines the dilation rate for the width dimension.
	DilationRateInX() uint
	SetDilationRateInX(value uint)
	// Defines the dilation rate for the height dimension.
	DilationRateInY() uint
	SetDilationRateInY(value uint)
	// Defines a mode for average pooling, where samples outside the input tensor count as zeroes in the average computation.
	IncludeZeroPadToAverage() bool
	SetIncludeZeroPadToAverage(value bool)
	// Defines the pooling window size for the height dimension.
	KernelHeight() uint
	SetKernelHeight(value uint)
	// Defines the pooling window size for the width dimension.
	KernelWidth() uint
	SetKernelWidth(value uint)
	// Defines the explicit padding value for the height dimension to add after the data.
	PaddingBottom() uint
	SetPaddingBottom(value uint)
	// Defines the explicit padding value for the width dimension to add before the data.
	PaddingLeft() uint
	SetPaddingLeft(value uint)
	// Defines the explicit padding value for the width dimension to add after the data.
	PaddingRight() uint
	SetPaddingRight(value uint)
	// Defines what kind of padding graph applies to the operation.
	PaddingStyle() MPSGraphPaddingStyle
	SetPaddingStyle(value MPSGraphPaddingStyle)
	// Defines the explicit padding value for the height dimension to add before the data.
	PaddingTop() uint
	SetPaddingTop(value uint)
	// Defines the data type for returned indices. Use this in conjunction with [maxPooling2DReturnIndices(_:descriptor:name:)](<https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/maxPooling2DReturnIndices(_:descriptor:name:)>) API. Currently MPSGraph supports the following datatypes: [MPSDataTypeInt32]. Default value: [MPSDataTypeInt32].
	ReturnIndicesDataType() uint32
	SetReturnIndicesDataType(value uint32)
	// Defines the mode for returned indices of maximum values within each pooling window. Use this in conjunction with [maxPooling2DReturnIndices(_:descriptor:name:)](<https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/maxPooling2DReturnIndices(_:descriptor:name:)>) API. If `returnIndicesMode = MPSGraphPoolingReturnIndicesNone` then only the first result MPSGraph returns from [maxPooling2DReturnIndices(_:descriptor:name:)](<https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/maxPooling2DReturnIndices(_:descriptor:name:)>) will be valid and using the second result will assert. Default value: [MPSGraphPoolingReturnIndicesNone].
	ReturnIndicesMode() MPSGraphPoolingReturnIndicesMode
	SetReturnIndicesMode(value MPSGraphPoolingReturnIndicesMode)
	// Defines the stride for the width dimension.
	StrideInX() uint
	SetStrideInX(value uint)
	// Defines the stride for the height dimension.
	StrideInY() uint
	SetStrideInY(value uint)

	// Sets the explicit padding values and sets padding style to explicit.
	SetExplicitPaddingWithPaddingLeftPaddingRightPaddingTopPaddingBottom(paddingLeft uint, paddingRight uint, paddingTop uint, paddingBottom uint)
}

An interface definition for the MPSGraphPooling2DOpDescriptor class.

Instance Properties

Instance Methods

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling2DOpDescriptor

type IMPSGraphPooling4DOpDescriptor

type IMPSGraphPooling4DOpDescriptor interface {
	IMPSGraphObject

	// Affects how MPSGraph computes the output size: if set to [YES] then output size is computed by rounding up instead of down when dividing input size by stride.
	CeilMode() bool
	SetCeilMode(value bool)
	// Defines dilation rates for spatial dimensions. Must be four numbers, one for each spatial dimension, fastest running index last.
	DilationRates() []foundation.NSNumber
	SetDilationRates(value []foundation.NSNumber)
	// Defines a mode for average pooling, where samples outside the input tensor count as zeroes in the average computation.
	IncludeZeroPadToAverage() bool
	SetIncludeZeroPadToAverage(value bool)
	// Defines the pooling window size.
	KernelSizes() []foundation.NSNumber
	SetKernelSizes(value []foundation.NSNumber)
	// Defines what kind of padding graph applies to the operation.
	PaddingStyle() MPSGraphPaddingStyle
	SetPaddingStyle(value MPSGraphPaddingStyle)
	// Defines padding values for spatial dimensions which must be eight numbers, two for each spatial dimension.
	PaddingValues() []foundation.NSNumber
	SetPaddingValues(value []foundation.NSNumber)
	// Defines the data type for returned indices.
	ReturnIndicesDataType() uint32
	SetReturnIndicesDataType(value uint32)
	// Defines the mode for returned indices of maximum values within each pooling window.
	ReturnIndicesMode() MPSGraphPoolingReturnIndicesMode
	SetReturnIndicesMode(value MPSGraphPoolingReturnIndicesMode)
	// Defines strides for spatial dimensions. Must be four numbers, one for each spatial dimension, fastest running index last.
	Strides() []foundation.NSNumber
	SetStrides(value []foundation.NSNumber)
}

An interface definition for the MPSGraphPooling4DOpDescriptor class.

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling4DOpDescriptor

type IMPSGraphRandomOpDescriptor

type IMPSGraphRandomOpDescriptor interface {
	IMPSGraphObject

	// The data type of the generated result values.
	DataType() uint32
	SetDataType(value uint32)
	// The type of distribution to draw samples from. See MPSGraphRandomDistribution.
	Distribution() MPSGraphRandomDistribution
	SetDistribution(value MPSGraphRandomDistribution)
	// The upper range of the distribution.
	Max() float32
	SetMax(value float32)
	// The upper range of the distribution.
	MaxInteger() int
	SetMaxInteger(value int)
	// The mean of the distribution.
	Mean() float32
	SetMean(value float32)
	// The lower range of the distribution.
	Min() float32
	SetMin(value float32)
	// The lower range of the distribution.
	MinInteger() int
	SetMinInteger(value int)
	// The sampling method of the distribution.
	SamplingMethod() MPSGraphRandomNormalSamplingMethod
	SetSamplingMethod(value MPSGraphRandomNormalSamplingMethod)
	// The standard deviation of the distribution.
	StandardDeviation() float32
	SetStandardDeviation(value float32)
}

An interface definition for the MPSGraphRandomOpDescriptor class.

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphRandomOpDescriptor

type IMPSGraphSDPADescriptor

type IMPSGraphSDPADescriptor interface {
	IMPSGraphObject

	// When YES, a causal (lower-triangular) mask is applied so that each query position attends only to key positions at or before it. Mutually exclusive with [maskTensor](<https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphSDPADescriptor/maskTensor>).
	IsCausal() bool
	SetIsCausal(value bool)
	// An optional additive mask tensor applied to the scaled QK^T scores before softmax. Must be broadcast-compatible with shape `[batch, heads, T_q, T_kv]`. Mutually exclusive with [isCausal](<https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphSDPADescriptor/isCausal>).
	MaskTensor() IMPSGraphTensor
	SetMaskTensor(value IMPSGraphTensor)
	// The scale applied to the result of the query–key matrix multiply before softmax. Typically set to `1/sqrt(headDimension)`.
	Scale() float32
	SetScale(value float32)
	// An optional attention-sinks tensor of shape `[nHeads]`. Each element seeds the online-softmax accumulator for the corresponding query head with a virtual token logit, causing real-token attention weights to sum to less than one.
	SinksTensor() IMPSGraphTensor
	SetSinksTensor(value IMPSGraphTensor)
}

An interface definition for the MPSGraphSDPADescriptor class.

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphSDPADescriptor

type IMPSGraphShapedType

type IMPSGraphShapedType interface {
	IMPSGraphType

	// Initializes a shaped type.
	InitWithShapeDataType(shape foundation.NSArray, dataType uint32) MPSGraphShapedType

	// The data type of the shaped type.
	DataType() uint32
	SetDataType(value uint32)
	// The Shape of the shaped type.
	Shape() foundation.NSArray
	SetShape(value foundation.NSArray)
}

An interface definition for the MPSGraphShapedType class.

Initializers

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphShapedType

type IMPSGraphSingleGateRNNDescriptor

type IMPSGraphSingleGateRNNDescriptor interface {
	IMPSGraphObject

	// A parameter that defines the activation function to use with the RNN operation.
	Activation() MPSGraphRNNActivation
	SetActivation(value MPSGraphRNNActivation)
	// A parameter that defines a bidirectional RNN layer.
	Bidirectional() bool
	SetBidirectional(value bool)
	// A parameter that defines time direction of the input sequence.
	Reverse() bool
	SetReverse(value bool)
	// A parameter that makes the RNN layer support training.
	Training() bool
	SetTraining(value bool)
}

An interface definition for the MPSGraphSingleGateRNNDescriptor class.

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphSingleGateRNNDescriptor

type IMPSGraphStencilOpDescriptor

type IMPSGraphStencilOpDescriptor interface {
	IMPSGraphObject

	// The property that determines which values to use for padding the input tensor.
	BoundaryMode() MPSGraphPaddingMode
	SetBoundaryMode(value MPSGraphPaddingMode)
	// The property that defines dilation rates for spatial dimensions.
	DilationRates() foundation.NSArray
	SetDilationRates(value foundation.NSArray)
	// The property that defines padding values for spatial dimensions.
	ExplicitPadding() foundation.NSArray
	SetExplicitPadding(value foundation.NSArray)
	// An array of length four that determines from which offset to start reading the input tensor.
	Offsets() foundation.NSArray
	SetOffsets(value foundation.NSArray)
	// The padding value for `boundaryMode = MPSGraphPaddingModeConstant`.
	PaddingConstant() float32
	SetPaddingConstant(value float32)
	// The property that defines what kind of padding to apply to the stencil operation.
	PaddingStyle() MPSGraphPaddingStyle
	SetPaddingStyle(value MPSGraphPaddingStyle)
	// The reduction mode to use within the stencil window.
	ReductionMode() MPSGraphReductionMode
	SetReductionMode(value MPSGraphReductionMode)
	// The property that defines strides for spatial dimensions.
	Strides() foundation.NSArray
	SetStrides(value foundation.NSArray)
}

An interface definition for the MPSGraphStencilOpDescriptor class.

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphStencilOpDescriptor

type IMPSGraphTensor

type IMPSGraphTensor interface {
	IMPSGraphObject

	// The data type of the tensor.
	DataType() uint32
	// The operation responsible for creating this tensor.
	Operation() IMPSGraphOperation
	// The shape of the tensor.
	Shape() foundation.NSArray
}

An interface definition for the MPSGraphTensor class.

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensor

type IMPSGraphTensorData

type IMPSGraphTensorData interface {
	IMPSGraphObject

	// Initializes a tensor data with an MPS matrix.
	InitWithMPSMatrix(matrix *metalperformanceshaders.MPSMatrix) MPSGraphTensorData
	// Initializes an MPSGraphTensorData with an MPS ndarray.
	InitWithMPSNDArray(ndarray *metalperformanceshaders.MPSNDArray) MPSGraphTensorData
	// Initializes a tensor data with an MPS image batch.
	InitWithMPSImageBatch(imageBatch foundation.NSArray) MPSGraphTensorData
	// Initializes an MPSGraphTensorData with an MTLTensor.
	InitWithMTLTensor(tensor metal.MTLTensor) MPSGraphTensorData
	// Initializes a tensor data with an MPS vector.
	InitWithMPSVector(vector *metalperformanceshaders.MPSVector) MPSGraphTensorData
	// Initializes a tensor data with an MPS vector enforcing rank of the result.
	InitWithMPSVectorRank(vector *metalperformanceshaders.MPSVector, rank uint) MPSGraphTensorData
	// Initializes a tensor data with an MPS matrix enforcing rank of the result.
	InitWithMPSMatrixRank(matrix *metalperformanceshaders.MPSMatrix, rank uint) MPSGraphTensorData
	// Initializes an tensor data with a metal buffer.
	InitWithMTLBufferShapeDataType(buffer metal.MTLBuffer, shape foundation.NSArray, dataType uint32) MPSGraphTensorData
	// Initializes an tensor data with a metal buffer.
	InitWithMTLBufferShapeDataTypeRowBytes(buffer metal.MTLBuffer, shape foundation.NSArray, dataType uint32, rowBytes uint) MPSGraphTensorData
	// Initializes the tensor data with an [NSData] on a device.
	InitWithDeviceDataShapeDataType(device IMPSGraphDevice, data foundation.NSData, shape foundation.NSArray, dataType uint32) MPSGraphTensorData

	// The data type of the tensor data.
	DataType() uint32
	// The device of the tensor data.
	Device() IMPSGraphDevice
	// The shape of the tensor data.
	Shape() foundation.NSArray

	// Return an mpsndarray object will copy contents if the contents are not stored in an MPS ndarray.
	Mpsndarray() metalperformanceshaders.MPSNDArray
}

An interface definition for the MPSGraphTensorData class.

Initializers

Instance Properties

Instance Methods

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorData

type IMPSGraphType

type IMPSGraphType interface {
	IMPSGraphObject
}

An interface definition for the MPSGraphType class.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphType

type IMPSGraphVariableOp

type IMPSGraphVariableOp interface {
	IMPSGraphOperation

	// The data type of the variable.
	DataType() uint32
	// The shape of the variable.
	Shape() foundation.NSArray
}

An interface definition for the MPSGraphVariableOp class.

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphVariableOp

type MPSGraph

type MPSGraph struct {
	MPSGraphObject
}

The optimized representation of a compute graph of operations and tensors.

Overview

An MPSGraph is a symbolic representation of operations to be utilized to execute compute graphs on a device.

Instance Properties

Instance Methods

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph

func MPSGraphFromID

func MPSGraphFromID(id objc.ID) MPSGraph

MPSGraphFromID constructs a MPSGraph from an objc.ID.

The optimized representation of a compute graph of operations and tensors.

func NewMPSGraph

func NewMPSGraph() MPSGraph

NewMPSGraph creates a new MPSGraph instance.

func (MPSGraph) AbsoluteSquareWithTensorName

func (g MPSGraph) AbsoluteSquareWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the absolute square of the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/absoluteSquare(tensor:name:)

func (MPSGraph) AbsoluteWithTensorName

func (g MPSGraph) AbsoluteWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the absolute values of the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/absolute(with:name:)

func (MPSGraph) AcosWithTensorName

func (g MPSGraph) AcosWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies the inverse cosine operation to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/acos(with:name:)

func (MPSGraph) AcoshWithTensorName

func (g MPSGraph) AcoshWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies the inverse hyperbolic cosine operation to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/acosh(with:name:)

func (MPSGraph) AdamWithCurrentLearningRateTensorBeta1TensorBeta2TensorEpsilonTensorValuesTensorMomentumTensorVelocityTensorMaximumVelocityTensorGradientTensorName

func (g MPSGraph) AdamWithCurrentLearningRateTensorBeta1TensorBeta2TensorEpsilonTensorValuesTensorMomentumTensorVelocityTensorMaximumVelocityTensorGradientTensorName(currentLearningRateTensor IMPSGraphTensor, beta1Tensor IMPSGraphTensor, beta2Tensor IMPSGraphTensor, epsilonTensor IMPSGraphTensor, valuesTensor IMPSGraphTensor, momentumTensor IMPSGraphTensor, velocityTensor IMPSGraphTensor, maximumVelocityTensor IMPSGraphTensor, gradientTensor IMPSGraphTensor, name string) []MPSGraphTensor

Creates operations to apply Adam optimization.

beta1Tensor: beta1Tensor

beta2Tensor: beta2Tensor

epsilonTensor: Epsilon tensor

valuesTensor: Values to update with optimization

momentumTensor: Momentum tensor

velocityTensor: Velocity tensor

maximumVelocityTensor: Optional maximum velocity tensor

gradientTensor: Partial gradient of the trainable parameters with respect to loss

name: Name for the operation

Return Value

If maximumVelocity is nil array of 3 tensors (update, newMomentum, newVelocity) else array of 4 tensors (update, newMomentum, newVelocity, newMaximumVelocity)

Discussion

The adam update ops are added

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/adam(currentLearningRate:beta1:beta2:epsilon:values:momentum:velocity:maximumVelocity:gradient:name:)

func (MPSGraph) AdamWithLearningRateTensorBeta1TensorBeta2TensorEpsilonTensorBeta1PowerTensorBeta2PowerTensorValuesTensorMomentumTensorVelocityTensorMaximumVelocityTensorGradientTensorName

func (g MPSGraph) AdamWithLearningRateTensorBeta1TensorBeta2TensorEpsilonTensorBeta1PowerTensorBeta2PowerTensorValuesTensorMomentumTensorVelocityTensorMaximumVelocityTensorGradientTensorName(learningRateTensor IMPSGraphTensor, beta1Tensor IMPSGraphTensor, beta2Tensor IMPSGraphTensor, epsilonTensor IMPSGraphTensor, beta1PowerTensor IMPSGraphTensor, beta2PowerTensor IMPSGraphTensor, valuesTensor IMPSGraphTensor, momentumTensor IMPSGraphTensor, velocityTensor IMPSGraphTensor, maximumVelocityTensor IMPSGraphTensor, gradientTensor IMPSGraphTensor, name string) []MPSGraphTensor

Creates operations to apply Adam optimization.

learningRateTensor: Scalar tensor which indicates the learning rate to use with the optimizer

beta1Tensor: beta1Tensor

beta2Tensor: beta2Tensor

beta1PowerTensor: `beta1^t` beta1 power tensor

beta2PowerTensor: `beta2^t` beta2 power tensor

valuesTensor: Values to update with optimization

momentumTensor: Momentum tensor

velocityTensor: Velocity tensor

maximumVelocityTensor: Optional maximum velocity tensor

gradientTensor: Partial gradient of the trainable parameters with respect to loss

name: Name for the operation

Return Value

If maximumVelocity is nil array of 3 tensors (update, newMomentum, newVelocity) else array of 4 tensors (update, newMomentum, newVelocity, newMaximumVelocity)

Discussion

The adam update ops are added current learning rate:

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/adam(learningRate:beta1:beta2:epsilon:beta1Power:beta2Power:values:momentum:velocity:maximumVelocity:gradient:name:)

func (MPSGraph) AdditionWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) AdditionWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Adds two input tensors.

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 an add operation and returns the result tensor. It supports broadcasting as well.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/addition(_:_:name:)

func (MPSGraph) ApplyStochasticGradientDescentWithLearningRateTensorVariableGradientTensorName

func (g MPSGraph) ApplyStochasticGradientDescentWithLearningRateTensorVariableGradientTensorName(learningRateTensor IMPSGraphTensor, variable IMPSGraphVariableOp, gradientTensor IMPSGraphTensor, name string) IMPSGraphOperation

The Stochastic gradient descent performs a gradient descent `variable = variable - (learningRate * g)` where, `g` is gradient of error wrt variable this op directly writes to the variable

learningRateTensor: Scalar tensor which indicates the learning rate to use with the optimizer

variable: Variable operation with trainable parameters

gradientTensor: Partial gradient of the trainable parameters with respect to loss

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/applyStochasticGradientDescent(learningRate:variable:gradient:name:)

func (MPSGraph) ArgSortWithTensorAxisDescendingName

func (g MPSGraph) ArgSortWithTensorAxisDescendingName(tensor IMPSGraphTensor, axis int, descending bool, name string) IMPSGraphTensor

Computes the indices that sort the elements of the input tensor along the specified axis.

tensor: The input tensor

axis: The tensor dimension over which you sort the tensor

descending: If true, reverse the sort direction

name: The name for the operation.

Return Value

A valid MPSGraphTensor object with 32-bit integer data type

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/argSort(_:axis:descending:name:)

func (MPSGraph) ArgSortWithTensorAxisName

func (g MPSGraph) ArgSortWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor

Computes the indices that sort the elements of the input tensor along the specified axis.

tensor: The input tensor

axis: The tensor dimension over which you sort the tensor

name: The name for the operation.

Return Value

A valid MPSGraphTensor object with 32-bit integer data type

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/argSort(_:axis:name:)

func (MPSGraph) ArgSortWithTensorAxisTensorDescendingName

func (g MPSGraph) ArgSortWithTensorAxisTensorDescendingName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, descending bool, name string) IMPSGraphTensor

Computes the indices that sort the elements of the input tensor along the specified axis.

tensor: The input tensor

axisTensor: The tensor dimension over which you sort the tensor

descending: If true, reverse the sort direction

name: The name for the operation.

Return Value

A valid MPSGraphTensor object with 32-bit integer data type

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/argSort(_:axisTensor:descending:name:)

func (MPSGraph) ArgSortWithTensorAxisTensorName

func (g MPSGraph) ArgSortWithTensorAxisTensorName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, name string) IMPSGraphTensor

Computes the indices that sort the elements of the input tensor along the specified axis.

tensor: The input tensor

axisTensor: The tensor dimension over which you sort the tensor

name: The name for the operation.

Return Value

A valid MPSGraphTensor object with 32-bit integer data type

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/argSort(_:axisTensor:name:)

func (MPSGraph) AsinWithTensorName

func (g MPSGraph) AsinWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies the inverse sine operation to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/asin(with:name:)

func (MPSGraph) AsinhWithTensorName

func (g MPSGraph) AsinhWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies the inverse hyperbolic sine operation to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/asinh(with:name:)

func (MPSGraph) AssignVariableWithValueOfTensorName

func (g MPSGraph) AssignVariableWithValueOfTensorName(variable IMPSGraphTensor, tensor IMPSGraphTensor, name string) IMPSGraphOperation

Creates an assign operation which writes at this point of execution of the graph.

variable: The variable resource tensor to assign to.

tensor: The tensor to assign to the variable.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/assign(_:tensor:name:)

func (MPSGraph) Atan2WithPrimaryTensorSecondaryTensorName

func (g MPSGraph) Atan2WithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the elementwise two-argument arctangent of the input tensors.

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 `atan2` operation and returns the result tensor. It supports broadcasting as well. Graph computes arc tangent of primaryTensor over secondaryTensor.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/atan2(withPrimaryTensor:secondaryTensor:name:)

func (MPSGraph) AtanWithTensorName

func (g MPSGraph) AtanWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies the inverse tangent operation to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/atan(with:name:)

func (MPSGraph) AtanhWithTensorName

func (g MPSGraph) AtanhWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies the inverse hyperbolic tangent operation to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/atanh(with:name:)

func (MPSGraph) Autorelease

func (g MPSGraph) Autorelease() MPSGraph

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraph) AvgPooling2DGradientWithGradientTensorSourceTensorDescriptorName

func (g MPSGraph) AvgPooling2DGradientWithGradientTensorSourceTensorDescriptorName(gradient IMPSGraphTensor, source IMPSGraphTensor, descriptor IMPSGraphPooling2DOpDescriptor, name string) IMPSGraphTensor

Creates a 2D average pooling gradient operation and returns the result tensor.

gradient: A 2D input gradient tensor - must be of rank=4. The layout is defined by `descriptor.DataLayout()`.

source: The input tensor for the forward pass.

descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates, paddings and layouts.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/avgPooling2DGradient(withGradientTensor:sourceTensor:descriptor:name:)

func (MPSGraph) AvgPooling2DWithSourceTensorDescriptorName

func (g MPSGraph) AvgPooling2DWithSourceTensorDescriptorName(source IMPSGraphTensor, descriptor IMPSGraphPooling2DOpDescriptor, name string) IMPSGraphTensor

Creates a 2D average-pooling operation and returns the result tensor.

source: A 2D Image source as tensor - must be of rank=4. The layout is defined by `descriptor.DataLayout()`.

descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates, paddings and layouts.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/avgPooling2D(withSourceTensor:descriptor:name:)

func (MPSGraph) AvgPooling4DGradientWithGradientTensorSourceTensorDescriptorName

func (g MPSGraph) AvgPooling4DGradientWithGradientTensorSourceTensorDescriptorName(gradient IMPSGraphTensor, source IMPSGraphTensor, descriptor IMPSGraphPooling4DOpDescriptor, name string) IMPSGraphTensor

Creates an average pooling gradient operation and returns the result tensor.

gradient: An input gradient tensor.

source: The input tensor for the forward pass.

descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates and paddings.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/avgPooling4DGradient(_:source:descriptor:name:)

func (MPSGraph) AvgPooling4DWithSourceTensorDescriptorName

func (g MPSGraph) AvgPooling4DWithSourceTensorDescriptorName(source IMPSGraphTensor, descriptor IMPSGraphPooling4DOpDescriptor, name string) IMPSGraphTensor

Creates a 4D average pooling operation and returns the result tensor.

source: A source tensor.

descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates and paddings.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/avgPooling4D(_:descriptor:name:)

func (MPSGraph) BandPartWithTensorNumLowerNumUpperName

func (g MPSGraph) BandPartWithTensorNumLowerNumUpperName(inputTensor IMPSGraphTensor, numLower int, numUpper int, name string) IMPSGraphTensor

Computes the band part of an input tensor.

inputTensor: Input tensor

numLower: The number of diagonals in the lower triangle to keep. If -1, the framework returns all sub diagnols.

numUpper: The number of diagonals in the upper triangle to keep. If -1, the framework returns all super diagnols.

name: Name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

This operation copies a diagonal band of values from input tensor to a result tensor of the same size. A coordinate `[..., i, j]` is in the band if

The values outside of the band are set to 0.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/bandPart(_:numLower:numUpper:name:)

func (MPSGraph) BandPartWithTensorNumLowerTensorNumUpperTensorName

func (g MPSGraph) BandPartWithTensorNumLowerTensorNumUpperTensorName(inputTensor IMPSGraphTensor, numLowerTensor IMPSGraphTensor, numUpperTensor IMPSGraphTensor, name string) IMPSGraphTensor

Creates the band part operation and returns the result.

inputTensor: The source tensor to copy.

numLowerTensor: Scalar Int32 tensor. The number of diagonals in the lower triangle to keep. If -1, keep all.

numUpperTensor: Scalar Int32 tensor. The number of diagonals in the upper triangle to keep. If -1, keep all.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

See above discussion of bandPartWithTensor: numLower: numUpper: name:

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/bandPart(_:numLowerTensor:numUpperTensor:name:)

func (MPSGraph) BatchToSpaceTensorSpatialAxesBatchAxisBlockDimensionsUsePixelShuffleOrderName

func (g MPSGraph) BatchToSpaceTensorSpatialAxesBatchAxisBlockDimensionsUsePixelShuffleOrderName(tensor IMPSGraphTensor, spatialAxes []foundation.NSNumber, batchAxis int, blockDimensions []foundation.NSNumber, usePixelShuffleOrder bool, name string) IMPSGraphTensor

Creates a batch-to-space operation and returns the result tensor.

tensor: The input tensor.

spatialAxes: The axes that define the dimensions containing the spatial blocks.

batchAxis: The axis that defines the destination dimension, where to copy the blocks.

blockDimensions: An array of numbers that defines the size of the rectangular spatial sub-block.

usePixelShuffleOrder: A parameter that controls layout of the sub-blocks within the batch dimension.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

This operation outputs a copy of the input tensor, where values from the `batchAxis` dimension are moved in spatial blocks of size `blockDimensions` to the `spatialAxes` dimensions (for `usePixelShuffleOrder=YES` 1,2 or 3 axes supported, otherwise limited only by [MPSNDArray] rank limitations). Use the `usePixelShuffleOrder` parameter to control how the data within spatial blocks is ordered in the `batchAxis` dimension: with `usePixelShuffleOrder = YES` MPSGraph stores the values of the spatial block contiguosly within the `batchAxis` dimension whereas without it they are stored interleaved with existing values in the `batchAxis` dimension. Note: This operation is the inverse of MPSGraph.SpaceToBatchTensorSpatialAxesBatchAxisBlockDimensionsUsePixelShuffleOrderName. Note: This operation is a generalization of MPSGraph.DepthToSpace2DTensorWidthAxisHeightAxisDepthAxisBlockSizeUsePixelShuffleOrderName.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/batchToSpace(_:spatialAxes:batchAxis:blockDimensions:usePixelShuffleOrder:name:)

func (MPSGraph) BatchToSpaceTensorSpatialAxesTensorBatchAxisTensorBlockDimensionsTensorUsePixelShuffleOrderName

func (g MPSGraph) BatchToSpaceTensorSpatialAxesTensorBatchAxisTensorBlockDimensionsTensorUsePixelShuffleOrderName(tensor IMPSGraphTensor, spatialAxesTensor IMPSGraphTensor, batchAxisTensor IMPSGraphTensor, blockDimensionsTensor IMPSGraphTensor, usePixelShuffleOrder bool, name string) IMPSGraphTensor

Creates a batch-to-space operation and returns the result tensor.

tensor: The input tensor.

spatialAxesTensor: A tensor that contains the axes that define the dimensions containing the spatial blocks.

batchAxisTensor: A tensor that contains the axis that defines the destination dimension, where to copy the blocks.

blockDimensionsTensor: A tensor that defines the size of the rectangular spatial sub-block.

usePixelShuffleOrder: A parameter that controls layout of the sub-blocks within the batch dimension.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

This operation outputs a copy of the input tensor, where values from the `batchAxisTensor` dimension are moved in spatial blocks of size `blockDimensionsTensor` to the `spatialAxesTensor` dimensions (for `usePixelShuffleOrder=YES` 1,2 or 3 axes supported, otherwise limited only by [MPSNDArray] rank limitations). Use the `usePixelShuffleOrder` parameter to control how the data within spatial blocks is ordered in the `batchAxisTensor` dimension: with `usePixelShuffleOrder = YES` MPSGraph stores the values of the spatial block contiguosly within the `batchAxisTensor` dimension whereas without it they are stored interleaved with existing values in the `batchAxisTensor` dimension. Note: This operation is the inverse of MPSGraph.SpaceToBatchTensorSpatialAxesTensorBatchAxisTensorBlockDimensionsTensorUsePixelShuffleOrderName. Note: This operation is a generalization of MPSGraph.DepthToSpace2DTensorWidthAxisTensorHeightAxisTensorDepthAxisTensorBlockSizeUsePixelShuffleOrderName.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/batchToSpace(_:spatialAxesTensor:batchAxisTensor:blockDimensionsTensor:usePixelShuffleOrder:name:)

func (MPSGraph) BitwiseANDWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) BitwiseANDWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the elementwise bitwise AND of binary representations of two integer tensors.

primaryTensor: The primary input tensor, must be of integer type.

secondaryTensor: The secondary input tensor, must be of integer type.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/bitwiseAND(_:_:name:)

func (MPSGraph) BitwiseLeftShiftWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) BitwiseLeftShiftWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the elementwise left-shifted binary representations of the primary integer by the secondary tensor amount.

primaryTensor: The primary input tensor, must be of integer type.

secondaryTensor: The secondary input tensor, must be of integer type.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/bitwiseLeftShift(_:_:name:)

func (MPSGraph) BitwiseNOTWithTensorName

func (g MPSGraph) BitwiseNOTWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies the bitwise NOT operation to the input tensor element.

tensor: The input tensor, which must be of integer type.

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 only accepts integer tensors.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/bitwiseNOT(_:name:)

func (MPSGraph) BitwiseORWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) BitwiseORWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the elementwise bitwise OR of binary representations of two integer tensors.

primaryTensor: The primary input tensor, must be of integer type.

secondaryTensor: The secondary input tensor, must be of integer type.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/bitwiseOR(_:_:name:)

func (MPSGraph) BitwisePopulationCountWithTensorName

func (g MPSGraph) BitwisePopulationCountWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the population count of the input tensor elements.

tensor: The input tensor, which must be of integer type.

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 only accepts integer tensors, and returns the number of bits set in the input element.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/bitwisePopulationCount(_:name:)

func (MPSGraph) BitwiseRightShiftWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) BitwiseRightShiftWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the elementwise right-shifted binary representations of the primary integer by the secondary tensor amount.

primaryTensor: The primary input tensor, must be of integer type.

secondaryTensor: The secondary input tensor, must be of integer type.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/bitwiseRightShift(_:_:name:)

func (MPSGraph) BitwiseXORWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) BitwiseXORWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the elementwise bitwise XOR of binary representations of two integer tensors.

primaryTensor: The primary input tensor, must be of integer type.

secondaryTensor: The secondary input tensor, must be of integer type.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/bitwiseXOR(_:_:name:)

func (MPSGraph) BottomKWithGradientTensorSourceAxisKName

func (g MPSGraph) BottomKWithGradientTensorSourceAxisKName(gradient IMPSGraphTensor, source IMPSGraphTensor, axis int, k uint, name string) IMPSGraphTensor

Creates a BottomKGradient operation and returns the result tensor.

gradient: Tensor containing the incoming gradient.

source: Tensor containing source data.

axis: The dimension along which to compute the BottomK values.

k: The number of largest values to return.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Finds the K smallest values along the minor dimension of the input. The input must have at least K elements along its minor dimension.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/bottomKGradient(_:source:axis:k:name:)

func (MPSGraph) BottomKWithGradientTensorSourceAxisTensorKTensorName

func (g MPSGraph) BottomKWithGradientTensorSourceAxisTensorKTensorName(gradient IMPSGraphTensor, source IMPSGraphTensor, axisTensor IMPSGraphTensor, kTensor IMPSGraphTensor, name string) IMPSGraphTensor

Creates a BottomKGradient operation and returns the result tensor.

gradient: Tensor containing the incoming gradient.

source: Tensor containing source data.

axisTensor: Tensor containing the dimension along which to compute the BottomK values.

kTensor: Tensor of the number of largest values to return.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Finds the K smallest values along the minor dimension of the input. The input must have at least K elements along its minor dimension.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/bottomKGradient(_:source:axisTensor:kTensor:name:)

func (MPSGraph) BottomKWithSourceTensorAxisKName

func (g MPSGraph) BottomKWithSourceTensorAxisKName(source IMPSGraphTensor, axis int, k uint, name string) []MPSGraphTensor

Creates a BottomK operation and returns the value and indices tensors.

source: Tensor containing source data.

axis: The dimension along which to compute the BottomK values.

k: The number of largest values to return.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array of size 2.

Discussion

Finds the k smallest values along the minor dimension of the input. The source must have at least k elements along its minor dimension. The first element of the result array corresponds to the bottom values, and the second array corresponds to the indices of the bottom values.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/bottomK(_:axis:k:name:)

func (MPSGraph) BottomKWithSourceTensorAxisTensorKTensorName

func (g MPSGraph) BottomKWithSourceTensorAxisTensorKTensorName(source IMPSGraphTensor, axisTensor IMPSGraphTensor, kTensor IMPSGraphTensor, name string) []MPSGraphTensor

Creates a BottomK operation and returns the result tensor.

source: Tensor containing source data.

axisTensor: Tensor containing the dimension along which to compute the BottomK values.

kTensor: Tensor of the number of largest values to return.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array of size 2.

Discussion

Finds the k smallest values along the minor dimension of the input. The source must have at least k elements along its minor dimension. The first element of the result array corresponds to the bottom values, and the second array corresponds to the indices of the bottom values.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/bottomK(_:axisTensor:kTensor:name:)

func (MPSGraph) BroadcastTensorToShapeName

func (g MPSGraph) BroadcastTensorToShapeName(tensor IMPSGraphTensor, shape foundation.NSArray, name string) IMPSGraphTensor

Creates a broadcast operation and returns the result tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/broadcast(_:shape:name:)

func (MPSGraph) BroadcastTensorToShapeTensorName

func (g MPSGraph) BroadcastTensorToShapeTensorName(tensor IMPSGraphTensor, shapeTensor IMPSGraphTensor, name string) IMPSGraphTensor

Creates a broadcast operation and returns the result tensor.

tensor: The Tensor to be broadcasted.

shapeTensor: A rank-1 tensor of type [MPSDataTypeInt32] or [MPSDataTypeInt64] that defines 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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/broadcast(_:shapeTensor:name:)

func (MPSGraph) CallSymbolNameInputTensorsOutputTypesName

func (g MPSGraph) CallSymbolNameInputTensorsOutputTypesName(symbolName string, inputTensors []MPSGraphTensor, outputTypes []MPSGraphType, name string) []MPSGraphTensor

Creates an operation which invokes another executable.

symbolName: The unique identifier used to find the executable in the `MPSGraphCompilationDescriptor.Callables()` directory.

inputTensors: The tensors which are passed as inputs to the executable being invoked.

outputTypes: The expected return types of the executable being invoked.

name: Name of operation.

Return Value

An array of valid MPSGraphTensor objects representing the return tensors of the invoked executable.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/call(symbolName:inputTensors:outputTypes:name:)

func (MPSGraph) CastTensorToTypeName

func (g MPSGraph) CastTensorToTypeName(tensor IMPSGraphTensor, type_ uint32, name string) IMPSGraphTensor

Creates a cast operation and returns the result tensor.

tensor: The input tensor.

type: The datatype to which MPSGraph casts the input.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Returns the input tensor casted to the specied data type.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/cast(_:to:name:)

func (MPSGraph) CeilWithTensorName

func (g MPSGraph) CeilWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies the ceiling operation to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/ceil(with:name:)

func (MPSGraph) ClampWithTensorMinValueTensorMaxValueTensorName

func (g MPSGraph) ClampWithTensorMinValueTensorMaxValueTensorName(tensor IMPSGraphTensor, minValueTensor IMPSGraphTensor, maxValueTensor IMPSGraphTensor, name string) IMPSGraphTensor

Clamps the values in the first tensor between the corresponding values in the minimum and maximum value tensor.

tensor: The tensor to be clamped.

minValueTensor: The tensor with min values to clamp to.

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 clamp operation and returns the result tensor. It supports broadcasting as well.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/clamp(_:min:max:name:)

func (MPSGraph) ColToImWithSourceTensorOutputShapeDescriptorName

func (g MPSGraph) ColToImWithSourceTensorOutputShapeDescriptorName(source IMPSGraphTensor, outputShape foundation.NSArray, descriptor IMPSGraphImToColOpDescriptor, name string) IMPSGraphTensor

Creates a column to image operation and returns the result tensor.

source: The tensor containing the source data. Must be of rank 4. The layout is defined by `descriptor.DataLayout()`.

outputShape: The result tensor shape.

descriptor: The descriptor object that specifies the parameters of the operation.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/colToIm(_:outputShape:descriptor:name:)

func (MPSGraph) CompileWithDeviceFeedsTargetTensorsTargetOperationsCompilationDescriptor

func (g MPSGraph) CompileWithDeviceFeedsTargetTensorsTargetOperationsCompilationDescriptor(device IMPSGraphDevice, feeds MPSGraphTensorShapedTypeDictionary, targetTensors []MPSGraphTensor, targetOperations []MPSGraphOperation, compilationDescriptor IMPSGraphCompilationDescriptor) IMPSGraphExecutable

Compiles the graph for the given feeds to returns the target tensor values, ensuring all target operations would be executed.

device: MPSGraph device to optimize for.

feeds: Feeds dictionary for the placeholder tensors.

targetTensors: Tensors for which the caller wishes MPSGraphTensorData to be returned.

targetOperations: Operations to be completed at the end of the run.

compilationDescriptor: Compilation descriptor to set different compilation parameters.

Return Value

A valid MPSGraphExecutable object

Discussion

This call blocks until execution has completed. The compilation descriptor helps specialize the executable returned.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/compile(with:feeds:targetTensors:targetOperations:compilationDescriptor:)

func (MPSGraph) ComplexTensorWithRealTensorImaginaryTensorName

func (g MPSGraph) ComplexTensorWithRealTensorImaginaryTensorName(realTensor IMPSGraphTensor, imaginaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns a complex tensor from the two input tensors.

realTensor: The real part of the complex tensor.

imaginaryTensor: The imaginary part of the complex tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/complexTensor(realTensor:imaginaryTensor:name:)

func (MPSGraph) ConcatTensorWithTensorDimensionName

func (g MPSGraph) ConcatTensorWithTensorDimensionName(tensor IMPSGraphTensor, tensor2 IMPSGraphTensor, dimensionIndex int, name string) IMPSGraphTensor

Creates a concatenation operation and returns the result tensor.

tensor: The first tensor to concatenate.

tensor2: The second tensor to concatenate.

dimensionIndex: The dimension to concatenate across, must be in range: `-rank <= dimension < rank`.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Concatenates two input tensors along the specified dimension. Tensors must be broadcast compatible along all other dimensions, and have the same datatype.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/concatTensor(_:with:dimension:name:)

func (MPSGraph) ConcatTensorsDimensionInterleaveName

func (g MPSGraph) ConcatTensorsDimensionInterleaveName(tensors []MPSGraphTensor, dimensionIndex int, interleave bool, name string) IMPSGraphTensor

Creates a concatenation operation and returns the result tensor.

tensors: The tensors to concatenate.

dimensionIndex: The dimension to concatenate across, must be in range: `-rank <= dimension < rank`.

interleave: A boolean value that specifies whether the operation interleaves input tensors.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Concatenates all input tensors along specified dimension. All inputs must be broadcast compatible along all other dimensions, and have the same type. When interleave is specified, all tensors will be interleaved. To interleave, make sure to provide broadcast compatible inputs along the specified dimension as well. For example:

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/concatTensors(_:dimension:interleave:name:)

func (MPSGraph) ConcatTensorsDimensionName

func (g MPSGraph) ConcatTensorsDimensionName(tensors []MPSGraphTensor, dimensionIndex int, name string) IMPSGraphTensor

Creates a concatenation operation and returns the result tensor.

tensors: The tensors to concatenate.

dimensionIndex: The dimension to concatenate across, must be in range: `-rank <= dimension < rank`.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Concatenates all input tensors along the specified dimension. All inputs must be broadcast compatible along all other dimensions, and have the same datatype.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/concatTensors(_:dimension:name:)

func (MPSGraph) ConjugateWithTensorName

func (g MPSGraph) ConjugateWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the complex conjugate of the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/conjugate(tensor:name:)

func (MPSGraph) ConstantWithDataShapeDataType

func (g MPSGraph) ConstantWithDataShapeDataType(data foundation.NSData, shape foundation.NSArray, dataType uint32) IMPSGraphTensor

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

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/constant(_:shape:dataType:)-ylr4

func (MPSGraph) ConstantWithRealPartImaginaryPart

func (g MPSGraph) ConstantWithRealPartImaginaryPart(realPart float64, imaginaryPart float64) IMPSGraphTensor

Creates a complex constant op with the MPSDataTypeComplexFloat32 data type and returns the result tensor.

realPart: The real part of the complex scalar to fill the entire tensor values with.

imaginaryPart: The imaginary part of the complex scalar to fill the entire tensor values with.

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/complexConstant(realPart:imaginaryPart:)

func (MPSGraph) ConstantWithRealPartImaginaryPartDataType

func (g MPSGraph) ConstantWithRealPartImaginaryPartDataType(realPart float64, imaginaryPart float64, dataType uint32) IMPSGraphTensor

Creates a complex constant operation and returns the result tensor.

realPart: The real part of the complex scalar to fill the entire tensor values with.

imaginaryPart: The imaginary part of the complex scalar to fill the entire tensor values with.

dataType: The dataType of the constant tensor.

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/complexConstant(realPart:imaginaryPart:dataType:)

func (MPSGraph) ConstantWithRealPartImaginaryPartShapeDataType

func (g MPSGraph) ConstantWithRealPartImaginaryPartShapeDataType(realPart float64, imaginaryPart float64, shape foundation.NSArray, dataType uint32) IMPSGraphTensor

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

realPart: The real part of the complex scalar to fill the entire tensor values with.

imaginaryPart: The imaginary part of the complex scalar to fill the entire tensor values with.

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

dataType: The dataType of the constant tensor.

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/complexConstant(realPart:imaginaryPart:shape:dataType:)

func (MPSGraph) ConstantWithScalarDataType

func (g MPSGraph) ConstantWithScalarDataType(scalar float64, dataType uint32) IMPSGraphTensor

Creates a constant operation and returns the result tensor.

scalar: The scalar value to fill the entire tensor values with.

dataType: The dataType of the constant tensor.

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/constant(_:dataType:)

func (MPSGraph) ConstantWithScalarShapeDataType

func (g MPSGraph) ConstantWithScalarShapeDataType(scalar float64, shape foundation.NSArray, dataType uint32) IMPSGraphTensor

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

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/constant(_:shape:dataType:)-3wa0e

func (MPSGraph) Convolution2DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeForwardConvolutionDescriptorName

func (g MPSGraph) Convolution2DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeForwardConvolutionDescriptorName(incomingGradient IMPSGraphTensor, weights IMPSGraphTensor, outputShape foundation.NSArray, forwardConvolutionDescriptor IMPSGraphConvolution2DOpDescriptor, name string) IMPSGraphTensor

Creates a 2D convolution gradient operation with respect to the source tensor of the forward convolution.

incomingGradient: Incoming loss gradient tensor

weights: Forward pass weights tensor

outputShape: Shape of the forward pass source tensor

forwardConvolutionDescriptor: Forward convolution 2D op `descriptor`

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

If [S] is source tensor to forward convolution, [R] is the result/returned tensor from forward convolution, and [L] is the loss function, `convolution2DDataGradientWithIncomingGradientTensor` returns tensor `dL/dS = dL/dR * dR/dS`, where `dL/dR` is the incomingGradient parameter.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/convolution2DDataGradient(_:weights:outputShape:forwardConvolutionDescriptor:name:)

func (MPSGraph) Convolution2DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeTensorForwardConvolutionDescriptorName

func (g MPSGraph) Convolution2DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeTensorForwardConvolutionDescriptorName(gradient IMPSGraphTensor, weights IMPSGraphTensor, outputShapeTensor IMPSGraphTensor, forwardConvolutionDescriptor IMPSGraphConvolution2DOpDescriptor, name string) IMPSGraphTensor

Creates a 2D convolution gradient operation with respect to the source tensor of the forward convolution.

weights: Forward pass weights tensor

outputShapeTensor: 4D Int32 or Int64 tensor. Shape of the forward pass source tensor

forwardConvolutionDescriptor: Forward convolution 2D op `descriptor`

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

If [S] is source tensor to forward convolution, [R] is the result/returned tensor of forward convolution, and [L] is the loss function, convolution2DDataGradientWithIncomingGradientTensor returns tensor `dL/dS = dL/dR * dR/dS`, where `dL/dR` is the incomingGradient parameter.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/convolution2DDataGradient(_:weights:outputShapeTensor:forwardConvolutionDescriptor:name:)

func (MPSGraph) Convolution2DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeForwardConvolutionDescriptorName

func (g MPSGraph) Convolution2DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeForwardConvolutionDescriptorName(incomingGradient IMPSGraphTensor, source IMPSGraphTensor, outputShape foundation.NSArray, forwardConvolutionDescriptor IMPSGraphConvolution2DOpDescriptor, name string) IMPSGraphTensor

Creates a 2D convolution gradient operation with respect to the weights tensor of the forward convolution.

incomingGradient: Incoming loss gradient tensor

outputShape: Shape of the forward pass source tensor

forwardConvolutionDescriptor: Forward convolution 2D op `descriptor`

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

If [W] is weights tensor to forward convolution, [R] is the result/returned tensor of forward convolution, and [L] is the loss function, convolution2DWeightsGradientWithIncomingGradientTensor returns tensor `dL/dW = dL/dR * dR/dW`, where `dL/dR` is the incomingGradient parameter.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/convolution2DWeightsGradient(_:source:outputShape:forwardConvolutionDescriptor:name:)

func (MPSGraph) Convolution2DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeTensorForwardConvolutionDescriptorName

func (g MPSGraph) Convolution2DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeTensorForwardConvolutionDescriptorName(gradient IMPSGraphTensor, source IMPSGraphTensor, outputShapeTensor IMPSGraphTensor, forwardConvolutionDescriptor IMPSGraphConvolution2DOpDescriptor, name string) IMPSGraphTensor

Creates a 2D convolution gradient operation with respect to weights tensor of forward convolution.

outputShapeTensor: 4D int32 or Int64 Tensor. Shape of the forward pass source tensor

forwardConvolutionDescriptor: Forward convolution 2D op `descriptor`

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

If [W] is weights tensor to forward convolution, [R] is the result/returned tensor of forward convolution, and [L] is the loss function, convolution2DWeightsGradientWithIncomingGradientTensor returns tensor `dL/dW = dL/dR * dR/dW`, where `dL/dR` is the incomingGradient parameter.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/convolution2DWeightsGradient(_:source:outputShapeTensor:forwardConvolutionDescriptor:name:)

func (MPSGraph) Convolution2DWithSourceTensorWeightsTensorDescriptorName

func (g MPSGraph) Convolution2DWithSourceTensorWeightsTensorDescriptorName(source IMPSGraphTensor, weights IMPSGraphTensor, descriptor IMPSGraphConvolution2DOpDescriptor, name string) IMPSGraphTensor

Creates a 2D (forward) convolution operation and returns the result tensor.

source: Source tensor - must be a rank 4 tensor. The layout is defined by `descriptor.DataLayout()`.

weights: Weights tensor, must be rank 4. The layout is defined by `descriptor.WeightsLayout()`.

descriptor: Specifies strides, dilation rates, paddings and layouts.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/convolution2D(_:weights:descriptor:name:)

func (MPSGraph) Convolution3DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeForwardConvolutionDescriptorName

func (g MPSGraph) Convolution3DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeForwardConvolutionDescriptorName(incomingGradient IMPSGraphTensor, weights IMPSGraphTensor, outputShape foundation.NSArray, forwardConvolutionDescriptor IMPSGraphConvolution3DOpDescriptor, name string) IMPSGraphTensor

Creates a 3D convolution gradient operation with respect to the source tensor of the forward convolution.

incomingGradient: Incoming loss gradient tensor

weights: Forward pass weights tensor

outputShape: Shape of the forward pass source tensor

forwardConvolutionDescriptor: Forward convolution 2D op `descriptor`

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

If [S] is source tensor to forward convolution, [R] is the result/returned tensor of forward convolution, and [L] is the loss function, convolution3DDataGradientWithIncomingGradientTensor returns tensor `dL/dS = dL/dR * dR/dS`, where `dL/dR` is the incomingGradient parameter.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/convolution3DDataGradient(_:weights:outputShape:forwardConvolutionDescriptor:name:)

func (MPSGraph) Convolution3DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeTensorForwardConvolutionDescriptorName

func (g MPSGraph) Convolution3DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeTensorForwardConvolutionDescriptorName(gradient IMPSGraphTensor, weights IMPSGraphTensor, outputShapeTensor IMPSGraphTensor, forwardConvolutionDescriptor IMPSGraphConvolution3DOpDescriptor, name string) IMPSGraphTensor

Creates a 3D convolution gradient operation with respect to the source tensor of the forward convolution.

weights: Forward pass weights tensor

outputShapeTensor: 4D Int32 or Int64 tensor. Shape of the forward pass source tensor

forwardConvolutionDescriptor: Forward convolution 2D op `descriptor`

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

If [S] is source tensor to forward convolution, [R] is the result/returned tensor of forward convolution, and [L] is the loss function, convolution3DDataGradientWithIncomingGradientTensor returns tensor `dL/dS = dL/dR * dR/dS`, where `dL/dR` is the incomingGradient parameter.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/convolution3DDataGradient(_:weights:outputShapeTensor:forwardConvolutionDescriptor:name:)

func (MPSGraph) Convolution3DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeForwardConvolutionDescriptorName

func (g MPSGraph) Convolution3DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeForwardConvolutionDescriptorName(incomingGradient IMPSGraphTensor, source IMPSGraphTensor, outputShape foundation.NSArray, forwardConvolutionDescriptor IMPSGraphConvolution3DOpDescriptor, name string) IMPSGraphTensor

Creates a 3D convolution gradient operation with respect to the weights tensor of the forward convolution.

incomingGradient: Incoming loss gradient tensor

outputShape: Shape of the forward pass source tensor

forwardConvolutionDescriptor: Forward convolution 2D op `descriptor`

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

If [W] is weights tensor to forward convolution, [R] is the result/returned tensor of forward convolution, and [L] is the loss function, convolution3DWeightsGradientWithIncomingGradientTensor returns tensor `dL/dW = dL/dR * dR/dW`, where `dL/dR` is the incomingGradient parameter.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/convolution3DWeightsGradient(_:source:outputShape:forwardConvolutionDescriptor:name:)

func (MPSGraph) Convolution3DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeTensorForwardConvolutionDescriptorName

func (g MPSGraph) Convolution3DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeTensorForwardConvolutionDescriptorName(gradient IMPSGraphTensor, source IMPSGraphTensor, outputShapeTensor IMPSGraphTensor, forwardConvolutionDescriptor IMPSGraphConvolution3DOpDescriptor, name string) IMPSGraphTensor

Creates a 3D convolution gradient operation with respect to the weights tensor of the forward convolution.

outputShapeTensor: 4D int32 or Int64 Tensor. Shape of the forward pass source tensor

forwardConvolutionDescriptor: Forward convolution 2D op `descriptor`

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

If [W] is weights tensor to forward convolution, [R] is the result/returned tensor of forward convolution, and [L] is the loss function, convolution3DWeightsGradientWithIncomingGradientTensor returns tensor `dL/dW = dL/dR * dR/dW`, where `dL/dR` is the incomingGradient parameter.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/convolution3DWeightsGradient(_:source:outputShapeTensor:forwardConvolutionDescriptor:name:)

func (MPSGraph) Convolution3DWithSourceTensorWeightsTensorDescriptorName

func (g MPSGraph) Convolution3DWithSourceTensorWeightsTensorDescriptorName(source IMPSGraphTensor, weights IMPSGraphTensor, descriptor IMPSGraphConvolution3DOpDescriptor, name string) IMPSGraphTensor

Creates a 3D forward convolution operation and returns the result tensor.

source: Source tensor - must be of rank 5. The layout is defined by `descriptor.DataLayout()`.

weights: Weights tensor, must be rank 5. The layout is defined by `descriptor.WeightsLayout()`.

descriptor: Specifies strides, dilation rates, paddings and layouts.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/convolution3D(_:weights:descriptor:name:)

func (MPSGraph) ConvolutionTranspose2DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeForwardConvolutionDescriptorName

func (g MPSGraph) ConvolutionTranspose2DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeForwardConvolutionDescriptorName(incomingGradient IMPSGraphTensor, weights IMPSGraphTensor, outputShape foundation.NSArray, forwardConvolutionDescriptor IMPSGraphConvolution2DOpDescriptor, name string) IMPSGraphTensor

Creates a convolution transpose gradient operation with respect to the source tensor of convolution transpose operation and returns the result tensor.

incomingGradient: Incoming gradient tensor

weights: Forward pass weights tensor

outputShape: Shape of the forward pass source tensor

forwardConvolutionDescriptor: Forward pass op descriptor

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Inserts an operation in graph to compute gradient of convolution transpose with respect to source tensor of the corresponding convolution transpose operation.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/convolutionTranspose2DDataGradient(_:weights:outputShape:forwardConvolutionDescriptor:name:)

func (MPSGraph) ConvolutionTranspose2DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeTensorForwardConvolutionDescriptorName

func (g MPSGraph) ConvolutionTranspose2DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeTensorForwardConvolutionDescriptorName(incomingGradient IMPSGraphTensor, weights IMPSGraphTensor, outputShape IMPSGraphTensor, forwardConvolutionDescriptor IMPSGraphConvolution2DOpDescriptor, name string) IMPSGraphTensor

Creates a convolution transpose gradient operation with respect to the source tensor of convolution transpose operation and returns the result tensor.

incomingGradient: Incoming gradient tensor

weights: Forward pass weights tensor

outputShape: 1D Int32 or Int64 Tensor. Shape of the forward pass source tensor

forwardConvolutionDescriptor: Forward pass op descriptor

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Inserts an operation in graph to compute gradient of convolution transpose with respect to source tensor of the corresponding convolution transpose operation.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/convolutionTranspose2DDataGradient(_:weights:outputShapeTensor:forwardConvolutionDescriptor:name:)

func (MPSGraph) ConvolutionTranspose2DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeForwardConvolutionDescriptorName

func (g MPSGraph) ConvolutionTranspose2DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeForwardConvolutionDescriptorName(incomingGradientTensor IMPSGraphTensor, source IMPSGraphTensor, outputShape foundation.NSArray, forwardConvolutionDescriptor IMPSGraphConvolution2DOpDescriptor, name string) IMPSGraphTensor

Creates a convolution transpose gradient operation with respect to the weights tensor of the convolution transpose operation and returns the result tensor.

incomingGradientTensor: Incoming gradient tensor

source: Forward pass source tensor

outputShape: Shape of the forward pass source weights tensor

forwardConvolutionDescriptor: Forward pass op descriptor

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Inserts an operation in graph to compute gradient of convolution transpose with respect to the weights tensor of the corresponding convolution transpose operation.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/convolutionTranspose2DWeightsGradient(_:weights:outputShape:forwardConvolutionDescriptor:name:)

func (MPSGraph) ConvolutionTranspose2DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeTensorForwardConvolutionDescriptorName

func (g MPSGraph) ConvolutionTranspose2DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeTensorForwardConvolutionDescriptorName(incomingGradientTensor IMPSGraphTensor, source IMPSGraphTensor, outputShape IMPSGraphTensor, forwardConvolutionDescriptor IMPSGraphConvolution2DOpDescriptor, name string) IMPSGraphTensor

Creates a convolution transpose gradient operation with respect to the weights tensor of the convolution transpose operation and returns the result tensor.

incomingGradientTensor: Incoming gradient tensor

source: Forward pass source tensor

outputShape: 1D Int32 or Int64 Tensor. Shape of the forward pass source weights tensor

forwardConvolutionDescriptor: Forward pass op descriptor

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Inserts an operation in graph to compute gradient of convolution transpose with respect to the weights tensor of the corresponding convolution transpose operation.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/convolutionTranspose2DWeightsGradient(_:weights:outputShapeTensor:forwardConvolutionDescriptor:name:)

func (MPSGraph) ConvolutionTranspose2DWithSourceTensorWeightsTensorOutputShapeDescriptorName

func (g MPSGraph) ConvolutionTranspose2DWithSourceTensorWeightsTensorOutputShapeDescriptorName(source IMPSGraphTensor, weights IMPSGraphTensor, outputShape foundation.NSArray, descriptor IMPSGraphConvolution2DOpDescriptor, name string) IMPSGraphTensor

Creates a convolution transpose operation and returns the result tensor.

source: Input tensor

weights: Weights tensor

outputShape: Shape of the result tensor.

descriptor: Descriptor for the corresponding forward 2D-convolution operation

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

Discussion

Convolution Tranpose operation is exactly the same as convolution gradint with respect to input image `convolution2DDataGradientWithIncomingGradient`. Weights tensor and source tensors are interpreted as they are in `convolution2DDataGradientWithIncomingGradient`. Convolution with stride `s` downsamples source tensor by factor `s` in spatial dimensions whereas convolution tranpose with stride `s` upsamples source tensor by factor `s`. Convolution transpose can map the same source size to multiple destination sizes. The relationship between the width of the source and the width of the destination is `(sourceWidth - 1)stride + 1 + (kernelWidth - 1)dilationRate <= destinationWidth + paddingLeft + paddingRight` so there are stride -1 values of the width of the destination that give same width of the source. In order to disambiguate, outputShape parameter is used.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/convolutionTranspose2D(_:weights:outputShape:descriptor:name:)

func (MPSGraph) ConvolutionTranspose2DWithSourceTensorWeightsTensorOutputShapeTensorDescriptorName

func (g MPSGraph) ConvolutionTranspose2DWithSourceTensorWeightsTensorOutputShapeTensorDescriptorName(source IMPSGraphTensor, weights IMPSGraphTensor, outputShape IMPSGraphTensor, descriptor IMPSGraphConvolution2DOpDescriptor, name string) IMPSGraphTensor

Creates a convolution transpose operation and returns the result tensor.

source: Input tensor

weights: Weights tensor

outputShape: 1D Int32 or Int64 tensor. shape of the result tensor.

descriptor: Descriptor for the corresponding forward Conv2D operation

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/convolutionTranspose2D(_:weights:outputShapeTensor:descriptor:name:)

func (MPSGraph) CoordinateAlongAxisTensorWithShapeName

func (g MPSGraph) CoordinateAlongAxisTensorWithShapeName(axisTensor IMPSGraphTensor, shape foundation.NSArray, name string) IMPSGraphTensor

Creates a get-coordindate operation and returns the result tensor.

axisTensor: A Scalar tensor of type [MPSDataTypeInt32], that specifies the coordinate axis an element’s value is set to. Negative values wrap around.

shape: The shape of the result tensor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

See MPSGraph.CoordinateAlongAxisWithShapeName.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/coordinate(alongAxisTensor:withShape:name:)

func (MPSGraph) CoordinateAlongAxisTensorWithShapeTensorName

func (g MPSGraph) CoordinateAlongAxisTensorWithShapeTensorName(axisTensor IMPSGraphTensor, shapeTensor IMPSGraphTensor, name string) IMPSGraphTensor

Creates a get-coordindate operation and returns the result tensor.

axisTensor: A Scalar tensor of type [MPSDataTypeInt32], that specifies the coordinate axis an element’s value is set to. Negative values wrap around.

shapeTensor: A rank-1 tensor of type [MPSDataTypeInt32] or [MPSDataTypeInt64] that defines the shape of the result tensor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

See MPSGraph.CoordinateAlongAxisWithShapeName.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/coordinate(alongAxisTensor:withShapeTensor:name:)

func (MPSGraph) CoordinateAlongAxisWithShapeName

func (g MPSGraph) CoordinateAlongAxisWithShapeName(axis int, shape foundation.NSArray, name string) IMPSGraphTensor

Creates a get-coordindate operation and returns the result tensor.

axis: The coordinate axis an element’s value is set to. Negative values wrap around.

shape: The shape of the result tensor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Creates a tensor of specified shape with value at index `[i_0, i_1, ... , i_N] = i_axis` For example,

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/coordinate(alongAxis:withShape:name:)

func (MPSGraph) CoordinateAlongAxisWithShapeTensorName

func (g MPSGraph) CoordinateAlongAxisWithShapeTensorName(axis int, shapeTensor IMPSGraphTensor, name string) IMPSGraphTensor

Creates a get-coordindate operation and returns the result tensor.

axis: The coordinate axis an element’s value is set to. Negative values wrap around.

shapeTensor: A rank-1 tensor of type [MPSDataTypeInt32] or [MPSDataTypeInt64] that defines the shape of the result tensor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

See MPSGraph.CoordinateAlongAxisWithShapeName.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/coordinate(alongAxis:withShapeTensor:name:)

func (MPSGraph) CosWithTensorName

func (g MPSGraph) CosWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies the cosine operation to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/cos(with:name:)

func (MPSGraph) CoshWithTensorName

func (g MPSGraph) CoshWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies the hyperbolic cosine operation to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/cosh(with:name:)

func (MPSGraph) CumulativeMaximumWithTensorAxisExclusiveReverseName

func (g MPSGraph) CumulativeMaximumWithTensorAxisExclusiveReverseName(tensor IMPSGraphTensor, axis int, exclusive bool, reverse bool, name string) IMPSGraphTensor

Computes the cumulative maximum of the input tensor along the specified axis.

tensor: The input tensor

axis: The tensor dimension where you compute the cumulative operation

exclusive: If true, perform the exclusive cumulative operation, and the first element will be equal to the lowest value of the tensor data type

reverse: If true, reverse the direction of the cumulative operation along the specified axis

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/cumulativeMaximum(_:axis:exclusive:reverse:name:)

func (MPSGraph) CumulativeMaximumWithTensorAxisName

func (g MPSGraph) CumulativeMaximumWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor

Computes the cumulative maximum of the input tensor along the specified axis.

tensor: The input tensor

axis: The tensor dimension where you compute the cumulative operation

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/cumulativeMaximum(_:axis:name:)

func (MPSGraph) CumulativeMaximumWithTensorAxisTensorExclusiveReverseName

func (g MPSGraph) CumulativeMaximumWithTensorAxisTensorExclusiveReverseName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, exclusive bool, reverse bool, name string) IMPSGraphTensor

Computes the cumulative maximum of the input tensor along the specified axis.

tensor: The input tensor

axisTensor: The tensor dimension where you compute the cumulative operation

exclusive: If true, perform the exclusive cumulative operation, and the first element will be equal to the lowest value of the tensor data type

reverse: If true, reverse the direction of the cumulative operation along the specified axis

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/cumulativeMaximum(_:axisTensor:exclusive:reverse:name:)

func (MPSGraph) CumulativeMaximumWithTensorAxisTensorName

func (g MPSGraph) CumulativeMaximumWithTensorAxisTensorName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, name string) IMPSGraphTensor

Computes the cumulative maximum of the input tensor along the specified axis.

tensor: The input tensor

axisTensor: The tensor dimension where you compute the cumulative operation

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/cumulativeMaximum(_:axisTensor:name:)

func (MPSGraph) CumulativeMinimumWithTensorAxisExclusiveReverseName

func (g MPSGraph) CumulativeMinimumWithTensorAxisExclusiveReverseName(tensor IMPSGraphTensor, axis int, exclusive bool, reverse bool, name string) IMPSGraphTensor

Computes the cumulative minimum of the input tensor along the specified axis.

tensor: The input tensor

axis: The tensor dimension where you compute the cumulative operation

exclusive: If true, perform the exclusive cumulative operation, and the first element will be equal to the largest value of the tensor data type

reverse: If true, reverse the direction of the cumulative operation along the specified axis

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/cumulativeMinimum(_:axis:exclusive:reverse:name:)

func (MPSGraph) CumulativeMinimumWithTensorAxisName

func (g MPSGraph) CumulativeMinimumWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor

Computes the cumulative minimum of the input tensor along the specified axis.

tensor: The input tensor

axis: The tensor dimension where you compute the cumulative operation

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/cumulativeMinimum(_:axis:name:)

func (MPSGraph) CumulativeMinimumWithTensorAxisTensorExclusiveReverseName

func (g MPSGraph) CumulativeMinimumWithTensorAxisTensorExclusiveReverseName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, exclusive bool, reverse bool, name string) IMPSGraphTensor

Computes the cumulative minimum of the input tensor along the specified axis.

tensor: The input tensor

axisTensor: The tensor dimension where you compute the cumulative operation

exclusive: If true, perform the exclusive cumulative operation, and the first element will be equal to the largest value of the tensor data type

reverse: If true, reverse the direction of the cumulative operation along the specified axis

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/cumulativeMinimum(_:axisTensor:exclusive:reverse:name:)

func (MPSGraph) CumulativeMinimumWithTensorAxisTensorName

func (g MPSGraph) CumulativeMinimumWithTensorAxisTensorName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, name string) IMPSGraphTensor

Computes the cumulative minimum of the input tensor along the specified axis.

tensor: The input tensor

axisTensor: The tensor dimension where you compute the cumulative operation

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/cumulativeMinimum(_:axisTensor:name:)

func (MPSGraph) CumulativeProductWithTensorAxisExclusiveReverseName

func (g MPSGraph) CumulativeProductWithTensorAxisExclusiveReverseName(tensor IMPSGraphTensor, axis int, exclusive bool, reverse bool, name string) IMPSGraphTensor

Computes the cumulative product of the input tensor along the specified axis.

tensor: The input tensor

axis: The tensor dimension where you compute the cumulative operation

exclusive: If true, perform the exclusive cumulative operation, and the first element will be equal to one

reverse: If true, reverse the direction of the cumulative operation along the specified axis

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/cumulativeProduct(_:axis:exclusive:reverse:name:)

func (MPSGraph) CumulativeProductWithTensorAxisName

func (g MPSGraph) CumulativeProductWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor

Computes the cumulative product of the input tensor along the specified axis.

tensor: The input tensor

axis: The tensor dimension where you compute the cumulative operation

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/cumulativeProduct(_:axis:name:)

func (MPSGraph) CumulativeProductWithTensorAxisTensorExclusiveReverseName

func (g MPSGraph) CumulativeProductWithTensorAxisTensorExclusiveReverseName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, exclusive bool, reverse bool, name string) IMPSGraphTensor

Computes the cumulative product of the input tensor along the specified axis.

tensor: The input tensor

axisTensor: The tensor dimension where you compute the cumulative operation

exclusive: If true, perform the exclusive cumulative operation, and the first element will be equal to one

reverse: If true, reverse the direction of the cumulative operation along the specified axis

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/cumulativeProduct(_:axisTensor:exclusive:reverse:name:)

func (MPSGraph) CumulativeProductWithTensorAxisTensorName

func (g MPSGraph) CumulativeProductWithTensorAxisTensorName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, name string) IMPSGraphTensor

Computes the cumulative product of the input tensor along the specified axis.

tensor: The input tensor

axisTensor: The tensor dimension where you compute the cumulative operation

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/cumulativeProduct(_:axisTensor:name:)

func (MPSGraph) CumulativeSumWithTensorAxisExclusiveReverseName

func (g MPSGraph) CumulativeSumWithTensorAxisExclusiveReverseName(tensor IMPSGraphTensor, axis int, exclusive bool, reverse bool, name string) IMPSGraphTensor

Computes the cumulative sum of the input tensor along the specified axis.

tensor: The input tensor

axis: The tensor dimension where you compute the cumulative operation

exclusive: If true, perform the exclusive cumulative operation, and the first element will be equal to zero

reverse: If true, reverse the direction of the cumulative operation along the specified axis

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/cumulativeSum(_:axis:exclusive:reverse:name:)

func (MPSGraph) CumulativeSumWithTensorAxisName

func (g MPSGraph) CumulativeSumWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor

Computes the cumulative sum of the input tensor along the specified axis.

tensor: The input tensor

axis: The tensor dimension where you compute the cumulative operation

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/cumulativeSum(_:axis:name:)

func (MPSGraph) CumulativeSumWithTensorAxisTensorExclusiveReverseName

func (g MPSGraph) CumulativeSumWithTensorAxisTensorExclusiveReverseName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, exclusive bool, reverse bool, name string) IMPSGraphTensor

Computes the cumulative sum of the input tensor along the specified axis.

tensor: The input tensor

axisTensor: The tensor dimension where you compute the cumulative operation

exclusive: If true, perform the exclusive cumulative operation, and the first element will be equal to zero

reverse: If true, reverse the direction of the cumulative operation along the specified axis

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/cumulativeSum(_:axisTensor:exclusive:reverse:name:)

func (MPSGraph) CumulativeSumWithTensorAxisTensorName

func (g MPSGraph) CumulativeSumWithTensorAxisTensorName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, name string) IMPSGraphTensor

Computes the cumulative sum of the input tensor along the specified axis.

tensor: The input tensor

axisTensor: The tensor dimension where you compute the cumulative operation

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/cumulativeSum(_:axisTensor:name:)

func (MPSGraph) DepthToSpace2DTensorWidthAxisHeightAxisDepthAxisBlockSizeUsePixelShuffleOrderName

func (g MPSGraph) DepthToSpace2DTensorWidthAxisHeightAxisDepthAxisBlockSizeUsePixelShuffleOrderName(tensor IMPSGraphTensor, widthAxis uint, heightAxis uint, depthAxis uint, blockSize uint, usePixelShuffleOrder bool, name string) IMPSGraphTensor

Creates a depth-to-space2D operation and returns the result tensor.

tensor: The input tensor.

widthAxis: The axis that defines the fastest running dimension within the block.

heightAxis: The axis that defines the 2nd fastest running dimension within the block.

depthAxis: The axis that defines the destination dimension, where to copy the blocks.

blockSize: The size of the square spatial sub-block.

usePixelShuffleOrder: A parameter that controls the layout of the sub-blocks within the depth dimension.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

This operation outputs a copy of the input tensor, where values from the `depthAxis` dimension are moved in spatial blocks of size `blockSize` to the `heightAxis` and `widthAxis` dimensions. Use the `usePixelShuffleOrder` parameter to control how the data within spatial blocks is ordered in the `depthAxis` dimension: with `usePixelShuffleOrder = YES` MPSGraph stores the values of the spatial block contiguosly within the `depthAxis` dimension, whereas without it they are stored interleaved with existing values in the `depthAxisTensor` dimension. This operation is the inverse of MPSGraph.SpaceToDepth2DTensorWidthAxisHeightAxisDepthAxisBlockSizeUsePixelShuffleOrderName.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/depth(toSpace2DTensor:widthAxis:heightAxis:depthAxis:blockSize:usePixelShuffleOrder:name:)

func (MPSGraph) DepthToSpace2DTensorWidthAxisTensorHeightAxisTensorDepthAxisTensorBlockSizeUsePixelShuffleOrderName

func (g MPSGraph) DepthToSpace2DTensorWidthAxisTensorHeightAxisTensorDepthAxisTensorBlockSizeUsePixelShuffleOrderName(tensor IMPSGraphTensor, widthAxisTensor IMPSGraphTensor, heightAxisTensor IMPSGraphTensor, depthAxisTensor IMPSGraphTensor, blockSize uint, usePixelShuffleOrder bool, name string) IMPSGraphTensor

Creates a depth-to-space2D operation and returns the result tensor.

tensor: The input tensor.

widthAxisTensor: A scalar tensor that contains the axis that defines the fastest running dimension within the block.

heightAxisTensor: A scalar tensor that contains the axis that defines the 2nd fastest running dimension within the block.

depthAxisTensor: A scalar tensor that contains the axis that defines the destination dimension, where to copy the blocks.

blockSize: The size of the square spatial sub-block.

usePixelShuffleOrder: A parameter that controls the layout of the sub-blocks within the depth dimension.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

This operation outputs a copy of the input tensor, where values from the `depthAxisTensor` dimension are moved in spatial blocks of size `blockSize` to the `heightAxisTensor` and `widthAxisTensor` dimensions. Use the `usePixelShuffleOrder` parameter to control how the data within spatial blocks is ordered in the `depthAxisTensor` dimension: with `usePixelShuffleOrder = YES` MPSGraph stores the values of the spatial block contiguosly within the `depthAxisTensor` dimension, whereas without it they are stored interleaved with existing values in the `depthAxisTensor` dimension. This operation is the inverse of MPSGraph.SpaceToDepth2DTensorWidthAxisTensorHeightAxisTensorDepthAxisTensorBlockSizeUsePixelShuffleOrderName.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/depth(toSpace2DTensor:widthAxisTensor:heightAxisTensor:depthAxisTensor:blockSize:usePixelShuffleOrder:name:)

func (MPSGraph) DepthwiseConvolution2DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeDescriptorName

func (g MPSGraph) DepthwiseConvolution2DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeDescriptorName(incomingGradient IMPSGraphTensor, weights IMPSGraphTensor, outputShape foundation.NSArray, descriptor IMPSGraphDepthwiseConvolution2DOpDescriptor, name string) IMPSGraphTensor

Creates a 2D-depthwise convolution gradient for data operation and returns the result tensor.

incomingGradient: A 2D input gradient tensor - must be of rank=4. The layout is defined by `descriptor.DataLayout()`.

weights: The weights tensor, must be rank=4. The layout is defined by `descriptor.WeightsLayout()`.

outputShape: The shape of the οutput tensor (and therefore input tensor of forward pass).

descriptor: The descriptor object that specifies strides, dilation rates, paddings and layouts.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/depthwiseConvolution2DDataGradient(_:weights:outputShape:descriptor:name:)

func (MPSGraph) DepthwiseConvolution2DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeDescriptorName

func (g MPSGraph) DepthwiseConvolution2DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeDescriptorName(incomingGradient IMPSGraphTensor, source IMPSGraphTensor, outputShape foundation.NSArray, descriptor IMPSGraphDepthwiseConvolution2DOpDescriptor, name string) IMPSGraphTensor

Creates a 2D-depthwise convolution gradient for weights operation and returns the result tensor.

incomingGradient: A 2D input gradient tensor - must be of rank=4. The layout is defined by `descriptor.DataLayout()`.

source: A 2D Image source as tensor - must be of rank=4. The layout is defined by `descriptor.DataLayout()`.

outputShape: The shape of the οutput tensor (and therefore weight tensor of forward pass).

descriptor: The descriptor object that specifies strides, dilation rates, paddings and layouts.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/depthwiseConvolution2DWeightsGradient(_:source:outputShape:descriptor:name:)

func (MPSGraph) DepthwiseConvolution2DWithSourceTensorWeightsTensorDescriptorName

func (g MPSGraph) DepthwiseConvolution2DWithSourceTensorWeightsTensorDescriptorName(source IMPSGraphTensor, weights IMPSGraphTensor, descriptor IMPSGraphDepthwiseConvolution2DOpDescriptor, name string) IMPSGraphTensor

Creates a 2D-depthwise convolution operation and returns the result tensor.

source: A 2D Image source as tensor - must be of rank=4. The layout is defined by `descriptor.DataLayout()`.

weights: The weights tensor, must be rank=4. The layout is defined by `descriptor.WeightsLayout()`.

descriptor: The descriptor object that specifies strides, dilation rates, paddings and layouts.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/depthwiseConvolution2D(_:weights:descriptor:name:)

func (MPSGraph) DepthwiseConvolution3DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeDescriptorName

func (g MPSGraph) DepthwiseConvolution3DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeDescriptorName(incomingGradient IMPSGraphTensor, weights IMPSGraphTensor, outputShape foundation.NSArray, descriptor IMPSGraphDepthwiseConvolution3DOpDescriptor, name string) IMPSGraphTensor

Creates a 3D depthwise convolution gradient for data operation and returns the result tensor.

incomingGradient: A 3D input gradient tensor - must be at least rank=4 (CDHW).

weights: The weights tensor, must be rank=4 - axes are interpreted as CDHW.

outputShape: The shape of the οutput tensor (and therefore input tensor of forward pass).

descriptor: The descriptor object that specifies strides, dilation rates and paddings.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/depthwiseConvolution3DDataGradient(_:weights:outputShape:descriptor:name:)

func (MPSGraph) DepthwiseConvolution3DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeDescriptorName

func (g MPSGraph) DepthwiseConvolution3DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeDescriptorName(incomingGradient IMPSGraphTensor, source IMPSGraphTensor, outputShape foundation.NSArray, descriptor IMPSGraphDepthwiseConvolution3DOpDescriptor, name string) IMPSGraphTensor

Creates a 3D depthwise convolution gradient for weights operation and returns the result tensor.

incomingGradient: A 3D input gradient tensor - must be at least rank=4 (NCDHW).

source: The forward pass 3D Image source as tensor - must be at least rank=4 (NCDHW).

outputShape: The shape of the οutput tensor (and therefore weight tensor of forward pass).

descriptor: The descriptor object that specifies strides, dilation rates and paddings.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/depthwiseConvolution3DWeightsGradient(_:source:outputShape:descriptor:name:)

func (MPSGraph) DepthwiseConvolution3DWithSourceTensorWeightsTensorDescriptorName

func (g MPSGraph) DepthwiseConvolution3DWithSourceTensorWeightsTensorDescriptorName(source IMPSGraphTensor, weights IMPSGraphTensor, descriptor IMPSGraphDepthwiseConvolution3DOpDescriptor, name string) IMPSGraphTensor

Creates a 3D depthwise convolution operation and returns the result tensor.

source: A 3D Image source as tensor - must be at least rank=4 (CDHW when channelDimensionIndex = -4).

weights: The weights tensor, must be rank=4 - axes are interpreted as CDHW when channelDimensionIndex = -4 .

descriptor: The descriptor object that specifies strides, dilation rates and paddings.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Works exactly like depthwise convolution2D, but in three dimensions. Supports different layouts with the MPSGraphDepthwiseConvolution3DOpDescriptor.ChannelDimensionIndex property. If your weights need a different layout add a permute operation on them before this operation.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/depthwiseConvolution3D(_:weights:descriptor:name:)

func (MPSGraph) DequantizeTensorLUTTensorAxisName

func (g MPSGraph) DequantizeTensorLUTTensorAxisName(tensor IMPSGraphTensor, LUTTensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor

Creates a vector lookup-table based quantization operation and returns the result tensor.

tensor: Input tensor to be dequantized.

LUTTensor: The lookup table to use - for u4 the second to last dimension should have 16 elements, and for u8 256 elements.

axis: Axis on which the scale 1D value is being broadcasted.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Converts a u8 or u4 `tensor` to a float tensor by applying a lookup operation, where each input index defines a vector of values. The operation reads the vector values from the last dimension of the lookup table tensor and stores them into the dimension defined by `axis` on the result tensor.

Note: The operation supports LUT groups up to the last 2 dimensions for `tensor`.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/dequantize(_:LUTTensor:axis:name:)

func (MPSGraph) DequantizeTensorLUTTensorName

func (g MPSGraph) DequantizeTensorLUTTensorName(tensor IMPSGraphTensor, LUTTensor IMPSGraphTensor, name string) IMPSGraphTensor

Creates a lookup-table based quantization operation and returns the result tensor.

tensor: Input tensor to be dequantized.

LUTTensor: The lookup table to use - for u4 the last dimension should have 16 elements, and for u8 256 elements.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Converts a u8 or u4 `tensor` to a float tensor by applying a lookup operation:

Note: The operation supports LUT groups up to the last 3 dimensions for `tensor`.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/dequantize(_:LUTTensor:name:)

func (MPSGraph) DequantizeTensorScaleTensorDataTypeName

func (g MPSGraph) DequantizeTensorScaleTensorDataTypeName(tensor IMPSGraphTensor, scaleTensor IMPSGraphTensor, dataType uint32, name string) IMPSGraphTensor

Creates a dequantize operation and returns the result tensor.

tensor: Input tensor to be dequantized.

scaleTensor: Scale Tensor parameter with groups support.

dataType: Float data type of the result tensor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array of datatype `dataType`.

Discussion

Converts the i8, u8, i4 or u4 `tensor` to a float tensor by applying a scale and bias transform:

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/dequantize(_:scaleTensor:dataType:name:)

func (MPSGraph) DequantizeTensorScaleTensorZeroPointDataTypeAxisName

func (g MPSGraph) DequantizeTensorScaleTensorZeroPointDataTypeAxisName(tensor IMPSGraphTensor, scaleTensor IMPSGraphTensor, zeroPoint float64, dataType uint32, axis int, name string) IMPSGraphTensor

Creates Dequantize operation and returns the result tensor.

tensor: Input tensor to be dequantized

scaleTensor: Scale scalar or 1D Tensor parameter with size == tensor.shape[axis]

zeroPoint: Bias scalar parameter (converted to dataType of tensor)

dataType: Float data type of the result tensor.

axis: Axis on which the scale 1D value is being broadcasted

name: The name for the operation.

Return Value

A valid MPSGraphTensor array of datatype dataType

Discussion

Convert the i8 or u8 `tensor` to a float tensor by applying a scale + bias transform: result = scaleTensor(tensor - zeroPoint)

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/dequantize(_:scaleTensor:zeroPoint:dataType:axis:name:)

func (MPSGraph) DequantizeTensorScaleTensorZeroPointTensorDataTypeAxisName

func (g MPSGraph) DequantizeTensorScaleTensorZeroPointTensorDataTypeAxisName(tensor IMPSGraphTensor, scaleTensor IMPSGraphTensor, zeroPointTensor IMPSGraphTensor, dataType uint32, axis int, name string) IMPSGraphTensor

Creates a dequantize operation and returns the result tensor.

tensor: Input tensor to be dequantized

scaleTensor: Scale scalar or 1D Tensor parameter with size == tensor.shape[axis]

zeroPointTensor: Bias scalar or 1D Tensor parameter with size == tensor.shape[axis]

dataType: Float data type of the result tensor.

axis: Axis on which the scale 1D value is being broadcasted

name: The name for the operation.

Return Value

A valid MPSGraphTensor array of datatype dataType

Discussion

Convert the i8 or u8 `tensor` to a float tensor by applying a scale + bias transform: result = scaleTensor(tensor - zeroPointTensor)

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/dequantize(_:scaleTensor:zeroPointTensor:dataType:axis:name:)

func (MPSGraph) DequantizeTensorScaleTensorZeroPointTensorDataTypeName

func (g MPSGraph) DequantizeTensorScaleTensorZeroPointTensorDataTypeName(tensor IMPSGraphTensor, scaleTensor IMPSGraphTensor, zeroPointTensor IMPSGraphTensor, dataType uint32, name string) IMPSGraphTensor

Creates a dequantize operation and returns the result tensor.

tensor: Input tensor to be dequantized.

scaleTensor: The scale tensor with groups support.

zeroPointTensor: The bias tensor with groups support.

dataType: Float data type of the result tensor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array of datatype `dataType`.

Discussion

Convert the i8, u8, i4 or u4 `tensor` to a float tensor by applying a scale and bias transform:

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/dequantize(_:scaleTensor:zeroPointTensor:dataType:name:)

func (MPSGraph) DequantizeTensorScaleZeroPointDataTypeName

func (g MPSGraph) DequantizeTensorScaleZeroPointDataTypeName(tensor IMPSGraphTensor, scale float64, zeroPoint float64, dataType uint32, name string) IMPSGraphTensor

Creates Dequantize operation and returns the result tensor.

tensor: Input tensor to be dequantized

scale: Scale scalar parameter

zeroPoint: Bias scalar parameter (converted to dataType of tensor)

dataType: Float data type of the result tensor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array of datatype dataType

Discussion

Convert the i8 or u8 `tensor` to a float tensor by applying a scale + bias transform: result = scale(tensor - zeroPoint)

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/dequantize(_:scale:zeroPoint:dataType:name:)

func (MPSGraph) DivisionNoNaNWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) DivisionNoNaNWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Divides the first input tensor by the second, with the result being 0 if the denominator is 0.

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

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/divisionNoNaN(_:_:name:)

func (MPSGraph) DivisionWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) DivisionWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Divides the first input tensor by the second.

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 divide operation and returns the result tensor. It supports broadcasting as well.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/division(_:_:name:)

func (MPSGraph) DropoutTensorRateName

func (g MPSGraph) DropoutTensorRateName(tensor IMPSGraphTensor, rate float64, name string) IMPSGraphTensor

Creates a dropout operation and returns the result

tensor: Input tensor

rate: The rate of values to be set to 0

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Removes values in the `tensor` with a percentage chance equal to `rate`. Removed values are set to 0

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/dropout(_:rate:name:)-6hvf3

func (MPSGraph) DropoutTensorRateTensorName

func (g MPSGraph) DropoutTensorRateTensorName(tensor IMPSGraphTensor, rate IMPSGraphTensor, name string) IMPSGraphTensor

Creates a dropout operation and returns the result

tensor: Input tensor

rate: The rate of values to be set to 0

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Removes values in the `tensor` with a percentage chance equal to `rate`. Removed values are set to 0

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/dropout(_:rate:name:)-16cq4

func (MPSGraph) EncodeToCommandBufferFeedsTargetOperationsResultsDictionaryExecutionDescriptor

func (g MPSGraph) EncodeToCommandBufferFeedsTargetOperationsResultsDictionaryExecutionDescriptor(commandBuffer *metalperformanceshaders.MPSCommandBuffer, feeds MPSGraphTensorDataDictionary, targetOperations []MPSGraphOperation, resultsDictionary MPSGraphTensorDataDictionary, executionDescriptor IMPSGraphExecutionDescriptor)

Encodes the graph for the given feeds to returns the target tensor values in the results dictionary provided by the user.

commandBuffer: commandBuffer passed to execute the graph on, commitAndContinue might be called, please don’t rely on underlying MTLCommandBuffer to remain uncommitted.

feeds: Feeds dictionary for the placeholder tensors.

targetOperations: Operations to be completed at the end of the run.

resultsDictionary: MPSGraphTensors dictionary passed by user, these will be filled with graph output data.

executionDescriptor: ExecutionDescriptor to be passed in and used.

Discussion

It ensures all target operations also executed. This call is asynchronous and will return immediately if a completionHandler is set.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/encode(to:feeds:targetOperations:resultsDictionary:executionDescriptor:)

func (MPSGraph) EncodeToCommandBufferFeedsTargetTensorsTargetOperationsExecutionDescriptor

func (g MPSGraph) EncodeToCommandBufferFeedsTargetTensorsTargetOperationsExecutionDescriptor(commandBuffer *metalperformanceshaders.MPSCommandBuffer, feeds MPSGraphTensorDataDictionary, targetTensors []MPSGraphTensor, targetOperations []MPSGraphOperation, executionDescriptor IMPSGraphExecutionDescriptor) MPSGraphTensorDataDictionary

Encodes the graph for the given feeds to returns the target tensor values, ensuring all target operations also executed.

commandBuffer: commandBuffer passed to exectute the graph on, it is an MPSCommandBuffer, commitAndContinue might be called, please don’t rely on underlying MTLCommandBuffer to remain uncommitted.

feeds: Feeds dictionary for the placeholder tensors.

targetTensors: Tensors for which the caller wishes MPSGraphTensorData to be returned.

targetOperations: Operations to be completed at the end of the run.

executionDescriptor: ExecutionDescriptor to be passed in and used.

Return Value

A valid MPSGraphTensor : MPSGraphTensorData dictionary with results synchronized to the CPU memory if MPSGraphOptionsSynchronizeResults set.

Discussion

This call is asynchronous and will return immediately if a completionHandler is set.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/encode(to:feeds:targetTensors:targetOperations:executionDescriptor:)

func (MPSGraph) EqualWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) EqualWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the elementwise equality check of the input tensors.

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 equal operation and returns the result tensor. It supports broadcasting as well.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/equal(_:_:name:)

func (MPSGraph) ErfWithTensorName

func (g MPSGraph) ErfWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies the error function to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/erf(with:name:)

func (MPSGraph) ExpandDimsOfTensorAxesName

func (g MPSGraph) ExpandDimsOfTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor

Creates an expand-dimensions operation and returns the result tensor.

tensor: The input tensor.

axes: The axes to expand.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Expands the tensor, inserting dimensions with size 1 at specified axes.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/expandDims(_:axes:name:)

func (MPSGraph) ExpandDimsOfTensorAxesTensorName

func (g MPSGraph) ExpandDimsOfTensorAxesTensorName(tensor IMPSGraphTensor, axesTensor IMPSGraphTensor, name string) IMPSGraphTensor

Creates an expand-dimensions operation and returns the result tensor.

tensor: The input tensor.

axesTensor: The tensor containing the axes to expand.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Expands the tensor, inserting dimensions with size 1 at specified axes.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/expandDims(_:axesTensor:name:)

func (MPSGraph) ExpandDimsOfTensorAxisName

func (g MPSGraph) ExpandDimsOfTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor

Creates an expand-dimensions operation and returns the result tensor.

tensor: The input tensor.

axis: The axis to expand.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Expands the tensor, inserting a dimension with size 1 at the specified axis.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/expandDims(_:axis:name:)

func (MPSGraph) ExponentBase2WithTensorName

func (g MPSGraph) ExponentBase2WithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies an exponent with base 2 to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/exponentBase2(with:name:)

func (MPSGraph) ExponentBase10WithTensorName

func (g MPSGraph) ExponentBase10WithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies an exponent with base 10 to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/exponentBase10(with:name:)

func (MPSGraph) ExponentWithTensorName

func (g MPSGraph) ExponentWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies the natural exponent to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/exponent(with:name:)

func (MPSGraph) FastFourierTransformWithTensorAxesDescriptorName

func (g MPSGraph) FastFourierTransformWithTensorAxesDescriptorName(tensor IMPSGraphTensor, axes []foundation.NSNumber, descriptor IMPSGraphFFTDescriptor, name string) IMPSGraphTensor

Creates a fast Fourier transform operation and returns the result tensor.

tensor: A complex or real-valued input tensor.

axes: An array of numbers that specifies over which axes MPSGraph performs the Fourier transform - all axes must be contained within last four dimensions of the input tensor.

descriptor: A descriptor that defines the parameters of the Fourier transform operation - see MPSGraphFFTDescriptor.

name: The name for the operation.

Return Value

A valid complex-valued MPSGraphTensor of the same shape as `tensor`.

Discussion

This operation computes the fast Fourier transform of the input tensor according to the following formulae.

`scale = 1` for `scaling_mode = none`, `scale = 1/V_f` for `scaling_mode = size`, `scale = 1/sqrt(V_f)` for `scaling_mode = unitary`, where `V_f` is the volume of the transformation defined by the dimensions included in `axes` (`V_f = prod_{i \in axes} shape(input)[i]`) (see MPSGraphFFTDescriptor.ScalingMode), `+` is selected in `+/-` when `inverse` is specified, otherwise `-` is used and the sum is done separately over each dimension in `axes` and `n` is the dimension length of that axis.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/fastFourierTransform(_:axes:descriptor:name:)

func (MPSGraph) FastFourierTransformWithTensorAxesTensorDescriptorName

func (g MPSGraph) FastFourierTransformWithTensorAxesTensorDescriptorName(tensor IMPSGraphTensor, axesTensor IMPSGraphTensor, descriptor IMPSGraphFFTDescriptor, name string) IMPSGraphTensor

Creates a fast Fourier transform operation and returns the result tensor.

tensor: A complex or real-valued input tensor.

axesTensor: A tensor of rank one containing the axes over which MPSGraph performs the transformation. See MPSGraph.FastFourierTransformWithTensorAxesDescriptorName.

descriptor: A descriptor that defines the parameters of the Fourier transform operation - see MPSGraphFFTDescriptor.

name: The name for the operation.

Return Value

A valid complex-valued MPSGraphTensor of the same shape as `tensor`.

Discussion

This operation computes the fast Fourier transform of the input tensor according to the following formulae.

`scale = 1` for `scaling_mode = none`, `scale = 1/V_f` for `scaling_mode = size`, `scale = 1/sqrt(V_f)` for `scaling_mode = unitary`, where `V_f` is the volume of the transformation defined by the dimensions included in `axes` (`V_f = prod_{i \in axes} shape(input)[i]`) (see MPSGraphFFTDescriptor.ScalingMode), `+` is selected in `+/-` when `inverse` is specified, otherwise `-` is used and the sum is done separately over each dimension in `axes` and `n` is the dimension length of that axis.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/fastFourierTransform(_:axesTensor:descriptor:name:)

func (MPSGraph) Flatten2DTensorAxisName

func (g MPSGraph) Flatten2DTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor

Creates a flatten2D operation and returns the result tensor.

tensor: The tensor to be flattened.

axis: The axis around which to flatten.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Flattens dimensions before `axis` to `result[0]` and dimensions starting from `axis` to `result[1]` and returns a rank-2 tensor as result.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/flatten2D(_:axis:name:)

func (MPSGraph) Flatten2DTensorAxisTensorName

func (g MPSGraph) Flatten2DTensorAxisTensorName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, name string) IMPSGraphTensor

Creates a flatten2D operation and returns the result tensor.

tensor: The tensor to be flattened.

axisTensor: A scalar tensor that contains the axis around which to flatten.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Flattens dimensions before `axis` to `result[0]` and dimensions starting from `axis` to `result[1]` and returns a rank-2 tensor as result.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/flatten2D(_:axisTensor:name:)

func (MPSGraph) FloorModuloWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) FloorModuloWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the remainder of floor divison between the primary and secondary tensor.

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

Creates a floorModulo operation and returns the result tensor, it supports broadcasting as well, returns 0 if divisor is 0.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/floorModulo(_:_:name:)

func (MPSGraph) FloorWithTensorName

func (g MPSGraph) FloorWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies the floor operation to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/floor(with:name:)

func (MPSGraph) GRUGradientsWithSourceTensorRecurrentWeightSourceGradientZStateOutputFwdInputWeightBiasDescriptorName

func (g MPSGraph) GRUGradientsWithSourceTensorRecurrentWeightSourceGradientZStateOutputFwdInputWeightBiasDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, sourceGradient IMPSGraphTensor, zState IMPSGraphTensor, outputFwd IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, descriptor IMPSGraphGRUDescriptor, name string) []MPSGraphTensor

Creates a GRU gradient operation and returns the gradient tensor values.

source: A tensor containing the source data `x[t]` with the data layout [T,N,I]. In case `inputWeight = nil` and `bidirectional = NO` then the layout is [T,N,3H] and for `inputWeight = nil` and `bidirectional = YES` the layout is [T,N,6H].

recurrentWeight: A tensor containing the recurrent weights [R]. For `bidirectional` the layout is [2,3H,H] and otherwise it is [3H,H].

sourceGradient: The input gradient, that is the gradient of a tensor with respect to the first output of the forward pass.

zState: The second output of MPSGraph.GRUWithSourceTensorRecurrentWeightInputWeightBiasInitStateDescriptorName with `descriptor.Training() = YES`.

outputFwd: The first output of MPSGraph.GRUWithSourceTensorRecurrentWeightInputWeightBiasInitStateDescriptorName with `descriptor.Training() = YES`.

inputWeight: A tensor containing the input weights matrix [W] - optional, if missing the operation assumes a diagonal unit-matrix. For `bidirectional` the layout is [6H,I] and otherwise it is [3H,I].

bias: A tensor containing the bias `b` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [6H] and otherwise it is [3H].

descriptor: A descriptor that defines the parameters for the GRU operation.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array containing gradients for each input tensor, except for `sourceGradient` and `mask`. In case an input is nil, no gradient will be returned for it. The order of the gradients will be: for `source`, for `recurrentWeight`, for `inputWeight` and for `bias`.

Discussion

For details of this operation and parameters, refer to documentation of MPSGraph.GRUWithSourceTensorRecurrentWeightInputWeightBiasInitStateMaskSecondaryBiasDescriptorName.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/GRUGradients(_:recurrentWeight:sourceGradient:zState:outputFwd:inputWeight:bias:descriptor:name:)

func (MPSGraph) GRUGradientsWithSourceTensorRecurrentWeightSourceGradientZStateOutputFwdInputWeightBiasInitStateDescriptorName

func (g MPSGraph) GRUGradientsWithSourceTensorRecurrentWeightSourceGradientZStateOutputFwdInputWeightBiasInitStateDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, sourceGradient IMPSGraphTensor, zState IMPSGraphTensor, outputFwd IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, descriptor IMPSGraphGRUDescriptor, name string) []MPSGraphTensor

Creates a GRU gradient operation and returns the gradient tensor values.

source: A tensor containing the source data `x[t]` with the data layout [T,N,I]. In case `inputWeight = nil` and `bidirectional = NO` then the layout is [T,N,3H] and for `inputWeight = nil` and `bidirectional = YES` the layout is [T,N,6H].

recurrentWeight: A tensor containing the recurrent weights [R]. For `bidirectional` the layout is [2,3H,H] and otherwise it is [3H,H].

sourceGradient: The input gradient, that is the gradient of a tensor with respect to the first output of the forward pass.

zState: The second output of MPSGraph.GRUWithSourceTensorRecurrentWeightInputWeightBiasInitStateDescriptorName with `descriptor.Training() = YES`.

outputFwd: The first output of MPSGraph.GRUWithSourceTensorRecurrentWeightInputWeightBiasInitStateDescriptorName with `descriptor.Training() = YES`.

inputWeight: A tensor containing the input weights matrix [W] - optional, if missing the operation assumes a diagonal unit-matrix. For `bidirectional` the layout is [6H,I] and otherwise it is [3H,I].

bias: A tensor containing the bias `b` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [6H] and otherwise it is [3H].

initState: The initial internal state of the LSTM `h[-1]` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].

descriptor: A descriptor that defines the parameters for the GRU operation.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array containing gradients for each input tensor, except for `sourceGradient` and `mask`. In case an input is nil, no gradient will be returned for it. The order of the gradients will be: for `source`, for `recurrentWeight`, for `inputWeight`, for `bias` and for `initState`.

Discussion

For details of this operation and parameters, refer to documentation of MPSGraph.GRUWithSourceTensorRecurrentWeightInputWeightBiasInitStateMaskSecondaryBiasDescriptorName.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/GRUGradients(_:recurrentWeight:sourceGradient:zState:outputFwd:inputWeight:bias:initState:descriptor:name:)

func (MPSGraph) GRUGradientsWithSourceTensorRecurrentWeightSourceGradientZStateOutputFwdStateGradientInputWeightBiasInitStateMaskSecondaryBiasDescriptorName

func (g MPSGraph) GRUGradientsWithSourceTensorRecurrentWeightSourceGradientZStateOutputFwdStateGradientInputWeightBiasInitStateMaskSecondaryBiasDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, sourceGradient IMPSGraphTensor, zState IMPSGraphTensor, outputFwd IMPSGraphTensor, stateGradient IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, mask IMPSGraphTensor, secondaryBias IMPSGraphTensor, descriptor IMPSGraphGRUDescriptor, name string) []MPSGraphTensor

Creates a GRU gradient operation and returns the gradient tensor values.

source: A tensor containing the source data `x[t]` with the data layout [T,N,I]. In case `inputWeight = nil` and `bidirectional = NO` then the layout is [T,N,3H] and for `inputWeight = nil` and `bidirectional = YES` the layout is [T,N,6H].

recurrentWeight: A tensor containing the recurrent weights [R]. For `bidirectional` the layout is [2,3H,H] and otherwise it is [3H,H].

sourceGradient: The input gradient, that is the gradient of a tensor with respect to the first output of the forward pass.

zState: The second output of MPSGraph.GRUWithSourceTensorRecurrentWeightInputWeightBiasInitStateDescriptorName with `descriptor.Training() = YES`.

outputFwd: The first output of MPSGraph.GRUWithSourceTensorRecurrentWeightInputWeightBiasInitStateDescriptorName with `descriptor.Training() = YES`.

stateGradient: The input gradient for state coming from the future timestep - optional, if missing the operation assumes zeroes.

inputWeight: A tensor containing the input weights matrix [W] - optional, if missing the operation assumes a diagonal unit-matrix. For `bidirectional` the layout is [6H,I] and otherwise it is [3H,I].

bias: A tensor containing the bias `b` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [6H] and otherwise it is [3H].

initState: The initial internal state of the LSTM `h[-1]` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].

mask: A tensor containing the mask `m` - optional, if missing the operation assumes ones. Useful for dropout.

secondaryBias: A tensor containing the secondary bias vector `b2` - optional, if missing the operation assumes zeroes. Only used with `reset_after = YES`. Shape is [H], ie. a vector for each gate, or [2H] for bidirectional.

descriptor: A descriptor that defines the parameters for the GRU operation.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array containing gradients for each input tensor, except for `sourceGradient` and `mask`. In case an input is nil, no gradient will be returned for it. The order of the gradients will be: for `source`, for `recurrentWeight`, for `inputWeight`, for `bias`, for `initState` and for `secondaryBias`.

Discussion

For details of this operation and parameters, refer to documentation of MPSGraph.GRUWithSourceTensorRecurrentWeightInputWeightBiasInitStateMaskSecondaryBiasDescriptorName.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/GRUGradients(_:recurrentWeight:sourceGradient:zState:outputFwd:stateGradient:inputWeight:bias:initState:mask:secondaryBias:descriptor:name:)

func (MPSGraph) GRUWithSourceTensorRecurrentWeightInputWeightBiasDescriptorName

func (g MPSGraph) GRUWithSourceTensorRecurrentWeightInputWeightBiasDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, descriptor IMPSGraphGRUDescriptor, name string) []MPSGraphTensor

Creates a GRU operation and returns the value and optionally the training state tensor.

source: A tensor containing the source data `x[t]` with the data layout [T,N,I]. In case `inputWeight = nil` and `bidirectional = NO` then the layout is [T,N,3H] and for `inputWeight = nil` and `bidirectional = YES` the layout is [T,N,6H].

recurrentWeight: A tensor containing the recurrent weights [R]. For `bidirectional` the layout is [2,3H,H] and otherwise it is [3H,H].

inputWeight: A tensor containing the input weights matrix [W] - optional, if missing the operation assumes a diagonal unit-matrix. For `bidirectional` the layout is [6H,I] and otherwise it is [3H,I].

bias: A tensor containing the bias `b` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [6H] and otherwise it is [3H].

descriptor: A descriptor that defines the parameters for the GRU operation.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array of size 1 or 2 depending on value of `descriptor.Training()`. The layout of the state output is [T,N,H] or [T,N,2H] for bidirectional, and the layout of the `trainingState` output is [T,N,3H] or [T,N,6H] for bidirectional.

Discussion

This operation returns tensors `h` and optionally `z` that are defined recursively as follows:

If `resetAfter = YES` then `c[t]` is replaced by

If `flipZ = YES` then `h[t]` is replaced by

[W] is optional `inputWeight`, [R] is `recurrentWeight`, `b` is optional `bias`, `m` is optional `mask`, `x[t]` is `source` `h[t]` is the first output, `z[t]` is the second output (optional) and `h[-1]` is `initState`. `b2` is an optional `resetBias` vector, only used when `resetAfter = YES`. See MPSGraphGRUDescriptor for different `activation` options for `f()`.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/GRU(_:recurrentWeight:inputWeight:bias:descriptor:name:)

func (MPSGraph) GRUWithSourceTensorRecurrentWeightInputWeightBiasInitStateDescriptorName

func (g MPSGraph) GRUWithSourceTensorRecurrentWeightInputWeightBiasInitStateDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, descriptor IMPSGraphGRUDescriptor, name string) []MPSGraphTensor

Creates a GRU operation and returns the value and optionally the training state tensor.

source: A tensor containing the source data `x[t]` with the data layout [T,N,I]. In case `inputWeight = nil` and `bidirectional = NO` then the layout is [T,N,3H] and for `inputWeight = nil` and `bidirectional = YES` the layout is [T,N,6H].

recurrentWeight: A tensor containing the recurrent weights [R]. For `bidirectional` the layout is [2,3H,H] and otherwise it is [3H,H].

inputWeight: A tensor containing the input weights matrix [W] - optional, if missing the operation assumes a diagonal unit-matrix. For `bidirectional` the layout is [6H,I] and otherwise it is [3H,I].

bias: A tensor containing the bias `b` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [6H] and otherwise it is [3H].

initState: The initial internal state of the LSTM `h[-1]` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].

descriptor: A descriptor that defines the parameters for the GRU operation.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array of size 1 or 2 depending on value of `descriptor.Training()`. The layout of the state output is [T,N,H] or [T,N,2H] for bidirectional, and the layout of the `trainingState` output is [T,N,3H] or [T,N,6H] for bidirectional.

Discussion

This operation returns tensors `h` and optionally `z` that are defined recursively as follows:

If `resetAfter = YES` then `c[t]` is replaced by

If `flipZ = YES` then `h[t]` is replaced by

[W] is optional `inputWeight`, [R] is `recurrentWeight`, `b` is optional `bias`, `m` is optional `mask`, `x[t]` is `source` `h[t]` is the first output, `z[t]` is the second output (optional) and `h[-1]` is `initState`. `b2` is an optional `resetBias` vector, only used when `resetAfter = YES`. See MPSGraphGRUDescriptor for different `activation` options for `f()`.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/GRU(_:recurrentWeight:inputWeight:bias:initState:descriptor:name:)

func (MPSGraph) GRUWithSourceTensorRecurrentWeightInputWeightBiasInitStateMaskSecondaryBiasDescriptorName

func (g MPSGraph) GRUWithSourceTensorRecurrentWeightInputWeightBiasInitStateMaskSecondaryBiasDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, mask IMPSGraphTensor, secondaryBias IMPSGraphTensor, descriptor IMPSGraphGRUDescriptor, name string) []MPSGraphTensor

Creates a GRU operation and returns the value and optionally the training state tensor.

source: A tensor containing the source data `x[t]` with the data layout [T,N,I]. In case `inputWeight = nil` and `bidirectional = NO` then the layout is [T,N,3H] and for `inputWeight = nil` and `bidirectional = YES` the layout is [T,N,6H].

recurrentWeight: A tensor containing the recurrent weights [R]. For `bidirectional` the layout is [2,3H,H] and otherwise it is [3H,H].

inputWeight: A tensor containing the input weights matrix [W] - optional, if missing the operation assumes a diagonal unit-matrix. For `bidirectional` the layout is [6H,I] and otherwise it is [3H,I].

bias: A tensor containing the bias `b` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [6H] and otherwise it is [3H].

initState: The initial internal state of the LSTM `h[-1]` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].

mask: A tensor containing the mask `m` - optional, if missing the operation assumes ones. Useful for dropout.

secondaryBias: A tensor containing the secondary bias vector `b2` - optional, if missing the operation assumes zeroes. Only used with `reset_after = YES`. Shape is [H], ie. a vector for each gate, or [2H] for bidirectional.

descriptor: A descriptor that defines the parameters for the GRU operation.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array of size 1 or 2 depending on value of `descriptor.Training()`. The layout of the state output is [T,N,H] or [T,N,2H] for bidirectional, and the layout of the `trainingState` output is [T,N,3H] or [T,N,6H] for bidirectional.

Discussion

This operation returns tensors `h` and optionally `z` that are defined recursively as follows:

If `resetAfter = YES` then `c[t]` is replaced by

If `flipZ = YES` then `h[t]` is replaced by

[W] is optional `inputWeight`, [R] is `recurrentWeight`, `b` is optional `bias`, `m` is optional `mask`, `x[t]` is `source` `h[t]` is the first output, `z[t]` is the second output (optional) and `h[-1]` is `initState`. `b2` is an optional `resetBias` vector, only used when `resetAfter = YES`. See MPSGraphGRUDescriptor for different `activation` options for `f()`.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/GRU(_:recurrentWeight:inputWeight:bias:initState:mask:secondaryBias:descriptor:name:)

func (MPSGraph) GatherAlongAxisTensorWithUpdatesTensorIndicesTensorName

func (g MPSGraph) GatherAlongAxisTensorWithUpdatesTensorIndicesTensorName(axisTensor IMPSGraphTensor, updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, name string) IMPSGraphTensor

Creates a GatherAlongAxis operation and returns the result tensor.

axisTensor: Scalar Int32 tensor. The axis to gather from. Negative values wrap around

updatesTensor: The input tensor to gather values from

indicesTensor: Int32 or Int64 tensor used to index `updatesTensor`

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Gather values from `updatesTensor` along the specified `axis` at indices in `indicesTensor`. The shape of `updatesTensor` and `indicesTensor` must match except at `axis`. The shape of the result tensor is equal to the shape of `indicesTensor`. If an index is out of bounds of the `updatesTensor` along `axis` a 0 is inserted.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/gatherAlongAxisTensor(_:updates:indices:name:)

func (MPSGraph) GatherAlongAxisWithUpdatesTensorIndicesTensorName

func (g MPSGraph) GatherAlongAxisWithUpdatesTensorIndicesTensorName(axis int, updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, name string) IMPSGraphTensor

Creates a GatherAlongAxis operation and returns the result tensor.

axis: The axis to gather from. Negative values wrap around

updatesTensor: The input tensor to gather values from

indicesTensor: Int32 or Int64 tensor used to index `updatesTensor`

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Gather values from `updatesTensor` along the specified `axis` at indices in `indicesTensor`. The shape of `updatesTensor` and `indicesTensor` must match except at `axis`. The shape of the result tensor is equal to the shape of `indicesTensor`. If an index is out of bounds of the `updatesTensor` along `axis` a 0 is inserted.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/gatherAlongAxis(_:updates:indices:name:)

func (MPSGraph) GatherNDWithUpdatesTensorIndicesTensorBatchDimensionsName

func (g MPSGraph) GatherNDWithUpdatesTensorIndicesTensorBatchDimensionsName(updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, batchDimensions uint, name string) IMPSGraphTensor

Creates a GatherND operation and returns the result tensor.

updatesTensor: Tensor containing slices to be inserted into the result tensor.

indicesTensor: Tensor containg the updates indices to read slices from

batchDimensions: The number of batch dimensions

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Gathers the slices in updatesTensor to the result tensor along the indices in indicesTensor. The gather is defined as

The tensors have the following shape requirements

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/gatherND(withUpdatesTensor:indicesTensor:batchDimensions:name:)

func (MPSGraph) GatherWithUpdatesTensorIndicesTensorAxisBatchDimensionsName

func (g MPSGraph) GatherWithUpdatesTensorIndicesTensorAxisBatchDimensionsName(updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, axis uint, batchDimensions uint, name string) IMPSGraphTensor

Creates a Gather operation and returns the result tensor.

updatesTensor: Tensor containing slices to be inserted into the result tensor.

indicesTensor: Tensor containg the updates indices to read slices from

axis: The dimension on which to perform the gather

batchDimensions: The number of batch dimensions

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Gathers the values in updatesTensor to the result tensor along the indices in indicesTensor. The gather is defined as

The tensors have the following shape requirements

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/gather(withUpdatesTensor:indicesTensor:axis:batchDimensions:name:)

func (MPSGraph) GradientForPrimaryTensorWithTensorsName

func (g MPSGraph) GradientForPrimaryTensorWithTensorsName(primaryTensor IMPSGraphTensor, tensors []MPSGraphTensor, name string) foundation.INSDictionary

Calculates a partial derivative of primaryTensor with respect to the tensors.

primaryTensor: Tensor to be differentiated (numerator).

tensors: Tensors to do the differentiation with (denominator).

name: Name for the gradient operation.

Return Value

A valid MPSGraphTensor dictionary object containing partial derivative d(primaryTensor)/d(secondaryTensor) for each tensor as key.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/gradients(of:with:name:)

func (MPSGraph) GreaterThanOrEqualToWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) GreaterThanOrEqualToWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Checks in an elementwise manner if the first input tensor is greater than or equal to the second.

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 `greaterThanOrEqual` operation and returns the result tensor. It supports broadcasting as well.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/greaterThanOrEqualTo(_:_:name:)

func (MPSGraph) GreaterThanWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) GreaterThanWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Checks in an elementwise manner if the first input tensor is greater than the second.

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 `greaterThan` operation and returns the result tensor. It supports broadcasting as well.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/greaterThan(_:_:name:)

func (MPSGraph) HammingDistanceWithPrimaryTensorSecondaryTensorResultDataTypeName

func (g MPSGraph) HammingDistanceWithPrimaryTensorSecondaryTensorResultDataTypeName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, resultDataType uint32, name string) IMPSGraphTensor

Computes the hamming distance of two input tensors with support for broadcasting.

primaryTensor: The first input tensor.

secondaryTensor: The second input tensor.

resultDataType: The datatype of the return MPSGraphTensor. Must be either [MPSDataTypeUInt32] or [MPSDataTypeUInt16].

name: The name for the operation.

Return Value

A valid tensor containing the hamming distance between the input tensors.

Discussion

The hamming distance is computed between 2 sets of vectors and the last dimension(s) of each input tensor is considered a vector.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/HammingDistance(primary:secondary:resultDataType:name:)

func (MPSGraph) HermiteanToRealFFTWithTensorAxesDescriptorName

func (g MPSGraph) HermiteanToRealFFTWithTensorAxesDescriptorName(tensor IMPSGraphTensor, axes []foundation.NSNumber, descriptor IMPSGraphFFTDescriptor, name string) IMPSGraphTensor

Creates a Hermitean-to-real fast Fourier transform operation and returns the result tensor.

tensor: A complex-valued input tensor with reduced size (see Discussion). Must have datatype [MPSDataTypeComplexFloat32] or [MPSDataTypeComplexFloat16].

axes: An array of numbers that specifies over which axes MPSGraph performs the Fourier transform - all axes must be contained within last four dimensions of the input tensor.

descriptor: A descriptor that defines the parameters of the Fourier transform operation - see MPSGraphFFTDescriptor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor of type [MPSDataTypeFloat32] or [MPSDataTypeFloat16] (full size).

Discussion

This operation computes the fast Fourier transform of a complex-valued input tensor according to the following formulae.

`in'[nu] = conjugate(in[n - nu])`, for the last dimension defined by `axes` when `nu` is out of range of the input dimension. `scale = 1` for `scaling_mode = none`, `scale = 1/V_f` for `scaling_mode = size`, `scale = 1/sqrt(V_f)` for `scaling_mode = unitary`, where `V_f` is the volume of the transformation defined by the dimensions included in `axes` (`V_f = prod_{i \in axes} shape(input)[i]`) (see MPSGraphFFTDescriptor.ScalingMode), `+` is selected in `+/-` when `inverse` is specified, otherwise `-` is used and the sum is done separately over each dimension in `axes` and `n` is the dimension length of that axis. With this API MPSGraph treats the input tensor to have only the unique frequencies, which means that the resulting tensor has size `(inSize-1)*2 + x` in the last dimension defined by `axes`, where `inSize = shape(input)[axis] ( = (n/2)+1 )` is the size of the input `tensor` in the last transformed dimension and `x = 1` when MPSGraphFFTDescriptor.RoundToOddHermitean = [YES] and `x = 0` otherwise.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/HermiteanToRealFFT(_:axes:descriptor:name:)

func (MPSGraph) HermiteanToRealFFTWithTensorAxesTensorDescriptorName

func (g MPSGraph) HermiteanToRealFFTWithTensorAxesTensorDescriptorName(tensor IMPSGraphTensor, axesTensor IMPSGraphTensor, descriptor IMPSGraphFFTDescriptor, name string) IMPSGraphTensor

Creates a Hermitean-to-real fast Fourier transform operation and returns the result tensor.

tensor: A complex-valued input tensor with reduced size (see Discussion). Must have datatype [MPSDataTypeComplexFloat32] or [MPSDataTypeComplexFloat16].

axesTensor: A tensor of rank one containing the axes over which MPSGraph performs the transformation. See MPSGraph.FastFourierTransformWithTensorAxesDescriptorName.

descriptor: A descriptor that defines the parameters of the Fourier transform operation - see MPSGraphFFTDescriptor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor of type [MPSDataTypeFloat32] or [MPSDataTypeFloat16] (full size).

Discussion

This operation computes the fast Fourier transform of a complex-valued input tensor according to the following formulae.

`in'[nu] = conjugate(in[n - nu])`, for the last dimension defined by `axes` when `nu` is out of range of the input dimension. `scale = 1` for `scaling_mode = none`, `scale = 1/V_f` for `scaling_mode = size`, `scale = 1/sqrt(V_f)` for `scaling_mode = unitary`, where `V_f` is the volume of the transformation defined by the dimensions included in `axes` (`V_f = prod_{i \in axes} shape(input)[i]`) (see MPSGraphFFTDescriptor.ScalingMode), `+` is selected in `+/-` when `inverse` is specified, otherwise `-` is used and the sum is done separately over each dimension in `axes` and `n` is the dimension length of that axis. With this API MPSGraph treats the input tensor to have only the unique frequencies, which means that the resulting tensor has size `(inSize-1)*2 + x` in the last dimension defined by `axes`, where `inSize = shape(input)[axis] ( = (n/2)+1 )` is the size of the input `tensor` in the last transformed dimension and `x = 1` when MPSGraphFFTDescriptor.RoundToOddHermitean = [YES] and `x = 0` otherwise.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/HermiteanToRealFFT(_:axesTensor:descriptor:name:)

func (MPSGraph) IdentityWithTensorName

func (g MPSGraph) IdentityWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Copies the input tensor values into the output, behaving as an identity operation.

tensor: The input tensor.

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

Return Value

A valid MPSGraphTensor object which is a copy of the input.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/identity(with:name:)

func (MPSGraph) ImToColWithSourceTensorDescriptorName

func (g MPSGraph) ImToColWithSourceTensorDescriptorName(source IMPSGraphTensor, descriptor IMPSGraphImToColOpDescriptor, name string) IMPSGraphTensor

Creates an imToCol operation and returns the result tensor.

source: The tensor containing the source data. Must be of rank 4. The layout is defined by `descriptor.DataLayout()`.

descriptor: The descriptor object that specifies the parameters of the operation.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/imToCol(_:descriptor:name:)

func (MPSGraph) ImaginaryPartOfTensorName

func (g MPSGraph) ImaginaryPartOfTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the imaginary part of a tensor.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/imaginaryPartOfTensor(tensor:name:)

func (MPSGraph) Init

func (g MPSGraph) Init() MPSGraph

Init initializes the instance.

func (MPSGraph) InverseOfTensorName

func (g MPSGraph) InverseOfTensorName(inputTensor IMPSGraphTensor, name string) IMPSGraphTensor

Computes the inverse of an input tensor.

inputTensor: The input tensor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object containing the inverse of the input tensor.

Discussion

The framework computes the inverse of a square matrix by calling LU decomposition and LU solver. All dimensions after the first 2 are treated as batch dimensions and the inverse for each batch is computed. Results are undefined for ill conditioned matrices.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/inverse(input:name:)

func (MPSGraph) IsFiniteWithTensorName

func (g MPSGraph) IsFiniteWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Checks if the input tensor elements are finite or not.

tensor: The input tensor.

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

If the input tensor element is finite, the operation returns `true`, else it returns `false`.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/isFinite(with:name:)

func (MPSGraph) IsInfiniteWithTensorName

func (g MPSGraph) IsInfiniteWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Checks if the input tensor elements are infinite or not.

tensor: The input tensor.

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

If the input tensor element is infinite, the operation returns `true`, else it returns `false`.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/isInfinite(with:name:)

func (MPSGraph) IsNaNWithTensorName

func (g MPSGraph) IsNaNWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Checks if the input tensor elements are [NaN] or not.

tensor: The input tensor.

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

If the input tensor element is [NaN], the operation returns `true`, else it returns `false`.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/isNaN(with:name:)

func (MPSGraph) L2NormPooling4DGradientWithGradientTensorSourceTensorDescriptorName

func (g MPSGraph) L2NormPooling4DGradientWithGradientTensorSourceTensorDescriptorName(gradient IMPSGraphTensor, source IMPSGraphTensor, descriptor IMPSGraphPooling4DOpDescriptor, name string) IMPSGraphTensor

Creates a L2-Norm pooling gradient operation and returns the result tensor.

gradient: An input gradient tensor.

source: The input tensor for the forward pass.

descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates and paddings.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/L2NormPooling4DGradient(_:source:descriptor:name:)

func (MPSGraph) L2NormPooling4DWithSourceTensorDescriptorName

func (g MPSGraph) L2NormPooling4DWithSourceTensorDescriptorName(source IMPSGraphTensor, descriptor IMPSGraphPooling4DOpDescriptor, name string) IMPSGraphTensor

Creates a 4D L2-norm pooling operation and returns the result tensor.

source: A source tensor.

descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates and paddings.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/L2NormPooling4D(_:descriptor:name:)

func (MPSGraph) LSTMGradientsWithSourceTensorRecurrentWeightSourceGradientZStateCellOutputFwdDescriptorName

func (g MPSGraph) LSTMGradientsWithSourceTensorRecurrentWeightSourceGradientZStateCellOutputFwdDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, sourceGradient IMPSGraphTensor, zState IMPSGraphTensor, cellOutputFwd IMPSGraphTensor, descriptor IMPSGraphLSTMDescriptor, name string) []MPSGraphTensor

Creates an LSTM gradient operation and returns the gradient tensor values.

source: A tensor containing the source data `x[t]` with the data layout [T,N,I]. In case `inputWeight = nil` and `bidirectional = NO` then the layout is [T,N,4H] and for `inputWeight = nil` and `bidirectional = YES` the layout is [T,N,8H].

recurrentWeight: A tensor containing the recurrent weights [R]. For `bidirectional` the layout is [2,4H,H] and otherwise it is [4H,H].

sourceGradient: The input gradient, that is the gradient of a tensor with respect to the first output of the forward pass.

zState: The third output of MPSGraph.LSTMWithSourceTensorRecurrentWeightInputWeightBiasInitStateInitCellDescriptorName with `descriptor.Training() = YES`.

cellOutputFwd: The second output of MPSGraph.LSTMWithSourceTensorRecurrentWeightInputWeightBiasInitStateInitCellDescriptorName with `descriptor.Training() = YES` or `descriptor.ProduceCell() = YES`.

descriptor: A descriptor that defines the parameters for the LSTM operation.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array containing gradients for each input tensor, except for `sourceGradient` and `mask`. In case an input is nil, no gradient will be returned for it. The order of the gradients will be: for `source`, for `recurrentWeight`, for `inputWeight`, for `bias`, for `initState` and for `initCell`.

Discussion

For details of this operation and parameters, refer to documentation of MPSGraph.LSTMWithSourceTensorRecurrentWeightInputWeightBiasInitStateInitCellMaskPeepholeDescriptorName.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/LSTMGradients(_:recurrentWeight:sourceGradient:zState:cellOutputFwd:descriptor:name:)

func (MPSGraph) LSTMGradientsWithSourceTensorRecurrentWeightSourceGradientZStateCellOutputFwdInputWeightBiasInitStateInitCellDescriptorName

func (g MPSGraph) LSTMGradientsWithSourceTensorRecurrentWeightSourceGradientZStateCellOutputFwdInputWeightBiasInitStateInitCellDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, sourceGradient IMPSGraphTensor, zState IMPSGraphTensor, cellOutputFwd IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, initCell IMPSGraphTensor, descriptor IMPSGraphLSTMDescriptor, name string) []MPSGraphTensor

Creates an LSTM gradient operation and returns the gradient tensor values.

source: A tensor containing the source data `x[t]` with the data layout [T,N,I]. In case `inputWeight = nil` and `bidirectional = NO` then the layout is [T,N,4H] and for `inputWeight = nil` and `bidirectional = YES` the layout is [T,N,8H].

recurrentWeight: A tensor containing the recurrent weights [R]. For `bidirectional` the layout is [2,4H,H] and otherwise it is [4H,H].

sourceGradient: The input gradient, that is the gradient of a tensor with respect to the first output of the forward pass.

zState: The third output of MPSGraph.LSTMWithSourceTensorRecurrentWeightInputWeightBiasInitStateInitCellDescriptorName with `descriptor.Training() = YES`.

cellOutputFwd: The second output of MPSGraph.LSTMWithSourceTensorRecurrentWeightInputWeightBiasInitStateInitCellDescriptorName with `descriptor.Training() = YES` or `descriptor.ProduceCell() = YES`.

inputWeight: A tensor containing the input weights matrix [W] - optional, if missing the operation assumes a diagonal unit-matrix. For `bidirectional` the layout is [8H,I] and otherwise it is [4H,I].

bias: A tensor containing the bias `b` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [8H] and otherwise it is [4H].

initState: The initial internal state of the LSTM `h[-1]` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].

initCell: The initial internal cell of the LSTM `h[-1]` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].

descriptor: A descriptor that defines the parameters for the LSTM operation.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array containing gradients for each input tensor, except for `sourceGradient` and `mask`. In case an input is nil, no gradient will be returned for it. The order of the gradients will be: for `source`, for `recurrentWeight`, for `inputWeight`, for `bias`, for `initState` and for `initCell`.

Discussion

For details of this operation and parameters, refer to documentation of MPSGraph.LSTMWithSourceTensorRecurrentWeightInputWeightBiasInitStateInitCellMaskPeepholeDescriptorName.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/LSTMGradients(_:recurrentWeight:sourceGradient:zState:cellOutputFwd:inputWeight:bias:initState:initCell:descriptor:name:)

func (MPSGraph) LSTMGradientsWithSourceTensorRecurrentWeightSourceGradientZStateCellOutputFwdInputWeightBiasInitStateInitCellMaskDescriptorName

func (g MPSGraph) LSTMGradientsWithSourceTensorRecurrentWeightSourceGradientZStateCellOutputFwdInputWeightBiasInitStateInitCellMaskDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, sourceGradient IMPSGraphTensor, zState IMPSGraphTensor, cellOutputFwd IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, initCell IMPSGraphTensor, mask IMPSGraphTensor, descriptor IMPSGraphLSTMDescriptor, name string) []MPSGraphTensor

Creates an LSTM gradient operation and returns the gradient tensor values.

source: A tensor containing the source data `x[t]` with the data layout [T,N,I]. In case `inputWeight = nil` and `bidirectional = NO` then the layout is [T,N,4H] and for `inputWeight = nil` and `bidirectional = YES` the layout is [T,N,8H].

recurrentWeight: A tensor containing the recurrent weights [R]. For `bidirectional` the layout is [2,4H,H] and otherwise it is [4H,H].

sourceGradient: The input gradient, that is the gradient of a tensor with respect to the first output of the forward pass.

zState: The third output of MPSGraph.LSTMWithSourceTensorRecurrentWeightInputWeightBiasInitStateInitCellDescriptorName with `descriptor.Training() = YES`.

cellOutputFwd: The second output of MPSGraph.LSTMWithSourceTensorRecurrentWeightInputWeightBiasInitStateInitCellDescriptorName with `descriptor.Training() = YES` or `descriptor.ProduceCell() = YES`.

inputWeight: A tensor containing the input weights matrix [W] - optional, if missing the operation assumes a diagonal unit-matrix. For `bidirectional` the layout is [8H,I] and otherwise it is [4H,I].

bias: A tensor containing the bias `b` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [8H] and otherwise it is [4H].

initState: The initial internal state of the LSTM `h[-1]` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].

initCell: The initial internal cell of the LSTM `h[-1]` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].

mask: A tensor containing the mask `m` - optional, if missing the operation assumes ones. Useful for dropout.

descriptor: A descriptor that defines the parameters for the LSTM operation.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array containing gradients for each input tensor, except for `sourceGradient` and `mask`. In case an input is nil, no gradient will be returned for it. The order of the gradients will be: for `source`, for `recurrentWeight`, for `inputWeight`, for `bias`, for `peephole`, for `initState` and for `initCell`.

Discussion

For details of this operation and parameters, refer to documentation of MPSGraph.LSTMWithSourceTensorRecurrentWeightInputWeightBiasInitStateInitCellMaskPeepholeDescriptorName.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/LSTMGradients(_:recurrentWeight:sourceGradient:zState:cellOutputFwd:inputWeight:bias:initState:initCell:mask:descriptor:name:)

func (MPSGraph) LSTMGradientsWithSourceTensorRecurrentWeightSourceGradientZStateCellOutputFwdStateGradientCellGradientInputWeightBiasInitStateInitCellMaskPeepholeDescriptorName

func (g MPSGraph) LSTMGradientsWithSourceTensorRecurrentWeightSourceGradientZStateCellOutputFwdStateGradientCellGradientInputWeightBiasInitStateInitCellMaskPeepholeDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, sourceGradient IMPSGraphTensor, zState IMPSGraphTensor, cellOutputFwd IMPSGraphTensor, stateGradient IMPSGraphTensor, cellGradient IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, initCell IMPSGraphTensor, mask IMPSGraphTensor, peephole IMPSGraphTensor, descriptor IMPSGraphLSTMDescriptor, name string) []MPSGraphTensor

Creates an LSTM gradient operation and returns the gradient tensor values.

source: A tensor containing the source data `x[t]` with the data layout [T,N,I]. In case `inputWeight = nil` and `bidirectional = NO` then the layout is [T,N,4H] and for `inputWeight = nil` and `bidirectional = YES` the layout is [T,N,8H].

recurrentWeight: A tensor containing the recurrent weights [R]. For `bidirectional` the layout is [2,4H,H] and otherwise it is [4H,H].

sourceGradient: The input gradient, that is the gradient of a tensor with respect to the first output of the forward pass.

zState: The third output of MPSGraph.LSTMWithSourceTensorRecurrentWeightInputWeightBiasInitStateInitCellDescriptorName with `descriptor.Training() = YES`.

cellOutputFwd: The second output of MPSGraph.LSTMWithSourceTensorRecurrentWeightInputWeightBiasInitStateInitCellDescriptorName with `descriptor.Training() = YES` or `descriptor.ProduceCell() = YES`.

stateGradient: The input gradient for state coming from the future timestep - optional, if missing the operation assumes zeroes.

cellGradient: Input gradient for cell coming from the future timestep - optional, if missing the operation assumes zeroes.

inputWeight: A tensor containing the input weights matrix [W] - optional, if missing the operation assumes a diagonal unit-matrix. For `bidirectional` the layout is [8H,I] and otherwise it is [4H,I].

bias: A tensor containing the bias `b` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [8H] and otherwise it is [4H].

initState: The initial internal state of the LSTM `h[-1]` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].

initCell: The initial internal cell of the LSTM `h[-1]` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].

mask: A tensor containing the mask `m` - optional, if missing the operation assumes ones. Useful for dropout.

peephole: A tensor containing the peephole vector `v` - optional, if missing the operation assumes zeroes. Shape is [4H], ie. a vector for each gate, or [2,4H] for bidirectional.

descriptor: A descriptor that defines the parameters for the LSTM operation.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array containing gradients for each input tensor, except for `sourceGradient` and `mask`. In case an input is nil, no gradient will be returned for it. The order of the gradients will be: for `source`, for `recurrentWeight`, for `inputWeight`, for `bias`, for `peephole`, for `initState` and for `initCell`.

Discussion

For details of this operation and parameters, refer to documentation of MPSGraph.LSTMWithSourceTensorRecurrentWeightInputWeightBiasInitStateInitCellMaskPeepholeDescriptorName.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/LSTMGradients(_:recurrentWeight:sourceGradient:zState:cellOutputFwd:stateGradient:cellGradient:inputWeight:bias:initState:initCell:mask:peephole:descriptor:name:)

func (MPSGraph) LSTMWithSourceTensorRecurrentWeightInitStateInitCellDescriptorName

func (g MPSGraph) LSTMWithSourceTensorRecurrentWeightInitStateInitCellDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, initState IMPSGraphTensor, initCell IMPSGraphTensor, descriptor IMPSGraphLSTMDescriptor, name string) []MPSGraphTensor

Creates an LSTM operation and returns the value tensor and optionally the cell state tensor and the training state tensor.

source: A tensor containing the source data `x[t]` with the data layout [T,N,I]. In case `inputWeight = nil` and `bidirectional = NO` then the layout is [T,N,4H] and for `inputWeight = nil` and `bidirectional = YES` the layout is [T,N,8H].

recurrentWeight: A tensor containing the recurrent weights [R]. For `bidirectional` the layout is [2,4H,H] and otherwise it is [4H,H].

initState: The initial internal state of the LSTM `h[-1]` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].

initCell: The initial internal cell of the LSTM `h[-1]` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].

descriptor: A descriptor that defines the parameters for the LSTM operation.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array of size 1 or 2 or 3, depending on values of `descriptor.ProduceCell()` and `descriptor.Training()`. The layout of the both state and cell outputs are [T,N,H] or [T,N,2H] for bidirectional, and the layout of the trainingState output is [T,N,4H] or [T,N,8H] for bidirectional.

Discussion

This operation returns tensors `h` and optionally `c` and optionally `z` that are defined recursively as follows:

[W] is optional `inputWeight`, [R] is `recurrentWeight`, `b` is optional `bias`, `m` is optional `mask`, `x[t]` is `source` `h[t]` is the first output, `c[t]` is the second output (optional), `z[t]` is either the second or third output (optional), `h[-1]` is `initCell`. and `h[-1]` is `initState`. `p` is an optional peephole vector. See MPSGraphLSTMDescriptor for different `activation` options for `f()` and `g()`.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/LSTM(_:recurrentWeight:initState:initCell:descriptor:name:)

func (MPSGraph) LSTMWithSourceTensorRecurrentWeightInputWeightBiasInitStateInitCellDescriptorName

func (g MPSGraph) LSTMWithSourceTensorRecurrentWeightInputWeightBiasInitStateInitCellDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, initCell IMPSGraphTensor, descriptor IMPSGraphLSTMDescriptor, name string) []MPSGraphTensor

Creates an LSTM operation and returns the value tensor and optionally the cell state tensor and the training state tensor.

source: A tensor containing the source data `x[t]` with the data layout [T,N,I]. In case `inputWeight = nil` and `bidirectional = NO` then the layout is [T,N,4H] and for `inputWeight = nil` and `bidirectional = YES` the layout is [T,N,8H].

recurrentWeight: A tensor containing the recurrent weights [R]. For `bidirectional` the layout is [2,4H,H] and otherwise it is [4H,H].

inputWeight: A tensor containing the input weights matrix [W] - optional, if missing the operation assumes a diagonal unit-matrix. For `bidirectional` the layout is [8H,I] and otherwise it is [4H,I].

bias: A tensor containing the bias `b` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [8H] and otherwise it is [4H].

initState: The initial internal state of the LSTM `h[-1]` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].

initCell: The initial internal cell of the LSTM `h[-1]` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].

descriptor: A descriptor that defines the parameters for the LSTM operation.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array of size 1 or 2 or 3, depending on values of `descriptor.ProduceCell()` and `descriptor.Training()`. The layout of the both state and cell outputs are [T,N,H] or [T,N,2H] for bidirectional, and the layout of the trainingState output is [T,N,4H] or [T,N,8H] for bidirectional.

Discussion

This operation returns tensors `h` and optionally `c` and optionally `z` that are defined recursively as follows:

[W] is optional `inputWeight`, [R] is `recurrentWeight`, `b` is optional `bias`, `m` is optional `mask`, `x[t]` is `source` `h[t]` is the first output, `c[t]` is the second output (optional), `z[t]` is either the second or third output (optional), `h[-1]` is `initCell`. and `h[-1]` is `initState`. `p` is an optional peephole vector. See MPSGraphLSTMDescriptor for different `activation` options for `f()` and `g()`.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/LSTM(_:recurrentWeight:inputWeight:bias:initState:initCell:descriptor:name:)

func (MPSGraph) LSTMWithSourceTensorRecurrentWeightInputWeightBiasInitStateInitCellMaskPeepholeDescriptorName

func (g MPSGraph) LSTMWithSourceTensorRecurrentWeightInputWeightBiasInitStateInitCellMaskPeepholeDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, initCell IMPSGraphTensor, mask IMPSGraphTensor, peephole IMPSGraphTensor, descriptor IMPSGraphLSTMDescriptor, name string) []MPSGraphTensor

Creates an LSTM operation and returns the value tensor and optionally the cell state tensor and the training state tensor.

source: A tensor containing the source data `x[t]` with the data layout [T,N,I]. In case `inputWeight = nil` and `bidirectional = NO` then the layout is [T,N,4H] and for `inputWeight = nil` and `bidirectional = YES` the layout is [T,N,8H].

recurrentWeight: A tensor containing the recurrent weights [R]. For `bidirectional` the layout is [2,4H,H] and otherwise it is [4H,H].

inputWeight: A tensor containing the input weights matrix [W] - optional, if missing the operation assumes a diagonal unit-matrix. For `bidirectional` the layout is [8H,I] and otherwise it is [4H,I].

bias: A tensor containing the bias `b` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [8H] and otherwise it is [4H].

initState: The initial internal state of the LSTM `h[-1]` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].

initCell: The initial internal cell of the LSTM `h[-1]` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].

mask: A tensor containing the mask `m` - optional, if missing the operation assumes ones. Useful for dropout.

peephole: A tensor containing the peephole vector `v` - optional, if missing the operation assumes zeroes. Shape is [4H], ie. a vector for each gate, or [2,4H] for bidirectional.

descriptor: A descriptor that defines the parameters for the LSTM operation.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array of size 1 or 2 or 3, depending on values of `descriptor.ProduceCell()` and `descriptor.Training()`. The layout of the both state and cell outputs are [T,N,H] or [T,N,2H] for bidirectional, and the layout of the trainingState output is [T,N,4H] or [T,N,8H] for bidirectional.

Discussion

This operation returns tensors `h` and optionally `c` and optionally `z` that are defined recursively as follows:

[W] is optional `inputWeight`, [R] is `recurrentWeight`, `b` is optional `bias`, `m` is optional `mask`, `x[t]` is `source` `h[t]` is the first output, `c[t]` is the second output (optional), `z[t]` is either the second or third output (optional), `h[-1]` is `initCell`. and `h[-1]` is `initState`. `p` is an optional peephole vector. See MPSGraphLSTMDescriptor for different `activation` options for `f()` and `g()`.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/LSTM(_:recurrentWeight:inputWeight:bias:initState:initCell:mask:peephole:descriptor:name:)

func (MPSGraph) LeakyReLUGradientWithIncomingGradientSourceTensorAlphaTensorName

func (g MPSGraph) LeakyReLUGradientWithIncomingGradientSourceTensorAlphaTensorName(gradient IMPSGraphTensor, source IMPSGraphTensor, alphaTensor IMPSGraphTensor, name string) IMPSGraphTensor

Computes the gradient of the leaky rectified linear unit (ReLU) activation.

gradient: The incoming gradient tensor.

source: The input tensor in forward pass.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

This operation supports broadcasting with the alpha tensor.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/leakyReLUGradient(withIncomingGradient:sourceTensor:alphaTensor:name:)

func (MPSGraph) LeakyReLUWithTensorAlphaName

func (g MPSGraph) LeakyReLUWithTensorAlphaName(tensor IMPSGraphTensor, alpha float64, name string) IMPSGraphTensor

Computes the leaky rectified linear unit (ReLU) activation function on the input tensor.

tensor: An input tensor.

alpha: The scalar value alpha used by all elements in the input tensor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

The operation is: f(x) = max(x, alpha).

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/leakyReLU(with:alpha:name:)

func (MPSGraph) LeakyReLUWithTensorAlphaTensorName

func (g MPSGraph) LeakyReLUWithTensorAlphaTensorName(tensor IMPSGraphTensor, alphaTensor IMPSGraphTensor, name string) IMPSGraphTensor

Computes the leaky rectified linear unit (ReLU) activation function on the input tensor.

tensor: The input tensor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

The operation is: f(x) = max(x, alpha). This operation supports broadcasting with the alpha tensor.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/leakyReLU(with:alphaTensor:name:)

func (MPSGraph) LessThanOrEqualToWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) LessThanOrEqualToWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Checks in an elementwise manner if the first input tensor is less than or equal to the second.

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 `lessThanOrEqualTo` operation and returns the result tensor. It supports broadcasting as well.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/lessThanOrEqualTo(_:_:name:)

func (MPSGraph) LessThanWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) LessThanWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Checks in an elementwise manner if the first input tensor is less than the second.

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 `lessThan` operation and returns the result tensor. It supports broadcasting as well.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/lessThan(_:_:name:)

func (MPSGraph) LogarithmBase2WithTensorName

func (g MPSGraph) LogarithmBase2WithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Computes the logarithm with base 2 to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/logarithmBase2(with:name:)

func (MPSGraph) LogarithmBase10WithTensorName

func (g MPSGraph) LogarithmBase10WithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Computes the logarithm with base 10 to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/logarithmBase10(with:name:)

func (MPSGraph) LogarithmWithTensorName

func (g MPSGraph) LogarithmWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Computes the natural logarithm to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/logarithm(with:name:)

func (MPSGraph) LogicalANDWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) LogicalANDWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the elementwise logical AND of the input tensors.

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 logical AND operation and returns the result tensor. It supports broadcasting as well.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/logicalAND(_:_:name:)

func (MPSGraph) LogicalNANDWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) LogicalNANDWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the elementwise logical NAND of the input tensors.

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 logical NAND operation and returns the result tensor. It supports broadcasting as well.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/logicalNAND(_:_:name:)

func (MPSGraph) LogicalNORWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) LogicalNORWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the elementwise logical NOR of the input tensors.

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 logical NOR operation and returns the result tensor. It supports broadcasting as well.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/logicalNOR(_:_:name:)

func (MPSGraph) LogicalORWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) LogicalORWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the elementwise logical OR of the input tensors.

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 logical OR operation and returns the result tensor. It supports broadcasting as well.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/logicalOR(_:_:name:)

func (MPSGraph) LogicalXNORWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) LogicalXNORWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the elementwise logical XNOR of the input tensors.

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 logical XNOR operation and returns the result tensor. It supports broadcasting as well.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/logicalXNOR(_:_:name:)

func (MPSGraph) LogicalXORWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) LogicalXORWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the elementwise logical XOR of the input tensors.

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 logical XOR operation and returns the result tensor. It supports broadcasting as well.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/logicalXOR(_:_:name:)

func (MPSGraph) MatrixMultiplicationWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) MatrixMultiplicationWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Computes the matrix multiplication of 2 input tensors with support for broadcasting.

primaryTensor: The left-hand side tensor.

secondaryTensor: The right-hand side tensor.

name: The name for the operation.

Return Value

A valid tensor containing the product of the input matrices.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/matrixMultiplication(primary:secondary:name:)

func (MPSGraph) MaxPooling2DGradientWithGradientTensorIndicesTensorOutputShapeDescriptorName

func (g MPSGraph) MaxPooling2DGradientWithGradientTensorIndicesTensorOutputShapeDescriptorName(gradient IMPSGraphTensor, indices IMPSGraphTensor, outputShape foundation.NSArray, descriptor IMPSGraphPooling2DOpDescriptor, name string) IMPSGraphTensor

Creates a max-pooling gradient operation and returns the result tensor.

gradient: A 2D input gradient tensor - must be of rank=4. The layout is defined by `descriptor.DataLayout()`.

indices: The indices tensor returned from MPSGraph.MaxPooling2DReturnIndicesWithSourceTensorDescriptorName.

outputShape: The shape of the destination gradient.

descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates, paddings and layouts.

name: The name for the operation.

Return Value

Destination gradient tensor.

Discussion

With this API MPSGraph computes the max-pooling gradient efficiently by reusing the indices from the forward API instead of recomputing them. The descriptor must set `returnIndicesMode` and `returnIndicesDataType` to the same value as that set by the forward pass.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/maxPooling2DGradient(withGradientTensor:indicesTensor:outputShape:descriptor:name:)

func (MPSGraph) MaxPooling2DGradientWithGradientTensorIndicesTensorOutputShapeTensorDescriptorName

func (g MPSGraph) MaxPooling2DGradientWithGradientTensorIndicesTensorOutputShapeTensorDescriptorName(gradient IMPSGraphTensor, indices IMPSGraphTensor, outputShape IMPSGraphTensor, descriptor IMPSGraphPooling2DOpDescriptor, name string) IMPSGraphTensor

Creates a max-pooling gradient operation and returns the result tensor.

gradient: A 2D input gradient tensor - must be of rank=4. The layout is defined by `descriptor.DataLayout()`.

indices: The indices tensor returned from MPSGraph.MaxPooling2DReturnIndicesWithSourceTensorDescriptorName.

outputShape: A tensor containing the shape of the destination gradient.

descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates, paddings and layouts.

name: The name for the operation.

Return Value

Destination gradient tensor.

Discussion

With this API MPSGraph computes the max-pooling gradient efficiently by reusing the indices from the forward API instead of recomputing them. The descriptor must set `returnIndicesMode` and `returnIndicesDataType` to the same value as that set by the forward pass.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/maxPooling2DGradient(withGradientTensor:indicesTensor:outputShapeTensor:descriptor:name:)

func (MPSGraph) MaxPooling2DGradientWithGradientTensorSourceTensorDescriptorName

func (g MPSGraph) MaxPooling2DGradientWithGradientTensorSourceTensorDescriptorName(gradient IMPSGraphTensor, source IMPSGraphTensor, descriptor IMPSGraphPooling2DOpDescriptor, name string) IMPSGraphTensor

Creates a max-pooling gradient operation and returns the result tensor.

gradient: A 2D input gradient tensor - must be of rank=4. The layout is defined by `descriptor.DataLayout()`.

source: The input tensor for the forward pass.

descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates, paddings and layouts.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/maxPooling2DGradient(withGradientTensor:sourceTensor:descriptor:name:)

func (MPSGraph) MaxPooling2DReturnIndicesWithSourceTensorDescriptorName

func (g MPSGraph) MaxPooling2DReturnIndicesWithSourceTensorDescriptorName(source IMPSGraphTensor, descriptor IMPSGraphPooling2DOpDescriptor, name string) []MPSGraphTensor

Creates a 2D max-pooling operation and returns the result tensor and the corresponding indices tensor.

source: A 2D Image source as tensor - must be of rank=4. The layout is defined by `descriptor.DataLayout()`.

descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates, paddings and layouts.

name: The name for the operation.

Return Value

An array of two MPSGraphTensors. The first tensor holds the result of max pool and the second tensor holds the corresponding indices

Discussion

In order to Computes the indices, `returnIndicesMode` of the descriptor must be set. The datatype of indices tensor can be set using `returnIndicesDataType`. If `returnIndicesMode = MPSGraphPoolingReturnIndicesNone` then only the first result MPSGraph returns will be valid and using the second result will assert.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/maxPooling2DReturnIndices(_:descriptor:name:)

func (MPSGraph) MaxPooling2DWithSourceTensorDescriptorName

func (g MPSGraph) MaxPooling2DWithSourceTensorDescriptorName(source IMPSGraphTensor, descriptor IMPSGraphPooling2DOpDescriptor, name string) IMPSGraphTensor

Creates a 2D max-pooling operation and returns the result tensor.

source: A 2D Image source as tensor - must be of rank=4. The layout is defined by `descriptor.DataLayout()`.

descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates, paddings and layouts.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/maxPooling2D(withSourceTensor:descriptor:name:)

func (MPSGraph) MaxPooling4DGradientWithGradientTensorIndicesTensorOutputShapeDescriptorName

func (g MPSGraph) MaxPooling4DGradientWithGradientTensorIndicesTensorOutputShapeDescriptorName(gradient IMPSGraphTensor, indices IMPSGraphTensor, outputShape foundation.NSArray, descriptor IMPSGraphPooling4DOpDescriptor, name string) IMPSGraphTensor

Creates a max-pooling gradient operation and returns the result tensor.

gradient: An input gradient tensor.

indices: Indices tensor returned from MPSGraph.MaxPooling4DReturnIndicesWithSourceTensorDescriptorName.

outputShape: The shape of the destination gradient.

descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates, paddings and layouts.

name: The name for the operation.

Return Value

Destination gradient tensor.

Discussion

With this API MPSGraph computes the max-pooling gradient efficiently by reusing the indices from the forward API instead of recomputing them. The descriptor must set `returnIndicesMode` and `returnIndicesDataType` to the same value as that set by the forward pass.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/maxPooling4DGradient(withGradientTensor:indicesTensor:outputShape:descriptor:name:)

func (MPSGraph) MaxPooling4DGradientWithGradientTensorIndicesTensorOutputShapeTensorDescriptorName

func (g MPSGraph) MaxPooling4DGradientWithGradientTensorIndicesTensorOutputShapeTensorDescriptorName(gradient IMPSGraphTensor, indices IMPSGraphTensor, outputShape IMPSGraphTensor, descriptor IMPSGraphPooling4DOpDescriptor, name string) IMPSGraphTensor

Creates a max-pooling gradient operation and returns the result tensor.

gradient: An input gradient tensor.

indices: The indices tensor returned from MPSGraph.MaxPooling4DReturnIndicesWithSourceTensorDescriptorName.

outputShape: A tensor containing the shape of the destination gradient.

descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates, paddings and layouts.

name: The name for the operation.

Return Value

Destination gradient tensor.

Discussion

With this API MPSGraph computes the max-pooling gradient efficiently by reusing the indices from the forward API instead of recomputing them. The descriptor must set `returnIndicesMode` and `returnIndicesDataType` to the same value as that set by the forward pass.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/maxPooling4DGradient(withGradientTensor:indicesTensor:outputShapeTensor:descriptor:name:)

func (MPSGraph) MaxPooling4DGradientWithGradientTensorSourceTensorDescriptorName

func (g MPSGraph) MaxPooling4DGradientWithGradientTensorSourceTensorDescriptorName(gradient IMPSGraphTensor, source IMPSGraphTensor, descriptor IMPSGraphPooling4DOpDescriptor, name string) IMPSGraphTensor

Creates a max-pooling gradient operation and returns the result tensor.

gradient: An input gradient tensor.

source: The input tensor for the forward pass.

descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates and paddings.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/maxPooling4DGradient(_:source:descriptor:name:)

func (MPSGraph) MaxPooling4DReturnIndicesWithSourceTensorDescriptorName

func (g MPSGraph) MaxPooling4DReturnIndicesWithSourceTensorDescriptorName(source IMPSGraphTensor, descriptor IMPSGraphPooling4DOpDescriptor, name string) []MPSGraphTensor

Creates a 4D max-pooling operation and returns the result tensor and the corresponding indices tensor.

source: The source tensor on which pooling will be performed.

descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates and paddings.

name: The name for the operation.

Return Value

An array of two MPSGraphTensors. The first tensor holds the result of max pool and the second tensor holds the corresponding indices.

Discussion

In order to Computes the indices, `returnIndicesMode` of the descriptor must be set. The datatype of indices tensor can be set using `returnIndicesDataType`. If `returnIndicesMode = MPSGraphPoolingReturnIndicesNone` then only the first result MPSGraph returns will be valid and using the second result will assert.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/maxPooling4DReturnIndices(_:descriptor:name:)

func (MPSGraph) MaxPooling4DWithSourceTensorDescriptorName

func (g MPSGraph) MaxPooling4DWithSourceTensorDescriptorName(source IMPSGraphTensor, descriptor IMPSGraphPooling4DOpDescriptor, name string) IMPSGraphTensor

Creates a 4D max-pooling operation and returns the result tensor.

source: A source tensor.

descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates and paddings.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/maxPooling4D(_:descriptor:name:)

func (MPSGraph) MaximumWithNaNPropagationWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) MaximumWithNaNPropagationWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the elementwise maximum of the input tensors, while propagating [NaN] values.

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 maximum with [NaN] propagation operation and returns the result tensor. This means that if any of the elementwise operands is [NaN], the result is [NaN]. It supports broadcasting as well.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/maximumWithNaNPropagation(_:_:name:)

func (MPSGraph) MaximumWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) MaximumWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the elementwise maximum of the input tensors.

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 maximum operation and returns the result tensor. It supports broadcasting as well.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/maximum(_:_:name:)

func (MPSGraph) MeanOfTensorAxesName

func (g MPSGraph) MeanOfTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor

Returns the mean of the first input along the specified axes.

axes: A list of axes over which to perform the reduction. The order of dimensions goes from the slowest moving at axis=0 to the fastest moving dimension.

name: An optional name for the operation.

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/mean(of:axes:name:)

func (MPSGraph) MinimumWithNaNPropagationWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) MinimumWithNaNPropagationWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the elementwise minimum of the input tensors, while propagating [NaN] values.

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 minimum with [NaN] propagation operation and returns the result tensor. This means that if any of the elementwise operands is [NaN], the result is [NaN]. It supports broadcasting as well.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/minimumWithNaNPropagation(_:_:name:)

func (MPSGraph) MinimumWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) MinimumWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the elementwise minimum of the input tensors.

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 minimum operation and returns the result tensor. It supports broadcasting as well.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/minimum(_:_:name:)

func (MPSGraph) ModuloWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) ModuloWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the remainder obtained by dividing the first input tensor by the second.

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 modulo operation and returns the result tensor. It supports broadcasting as well.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/modulo(_:_:name:)

func (MPSGraph) MultiplicationWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) MultiplicationWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Multiplies two input tensors.

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 multiply operation and returns the result tensor. It supports broadcasting as well.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/multiplication(_:_:name:)

func (MPSGraph) NegativeWithTensorName

func (g MPSGraph) NegativeWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies negative to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/negative(with:name:)

func (MPSGraph) NonMaximumSuppressionWithBoxesTensorScoresTensorClassIndicesTensorIOUThresholdScoreThresholdPerClassSuppressionCoordinateModeName

func (g MPSGraph) NonMaximumSuppressionWithBoxesTensorScoresTensorClassIndicesTensorIOUThresholdScoreThresholdPerClassSuppressionCoordinateModeName(boxesTensor IMPSGraphTensor, scoresTensor IMPSGraphTensor, classIndicesTensor IMPSGraphTensor, IOUThreshold float32, scoreThreshold float32, perClassSuppression bool, coordinateMode MPSGraphNonMaximumSuppressionCoordinateMode, name string) IMPSGraphTensor

Creates a nonMaximumumSuppression operation and returns the result tensor.

boxesTensor: A tensor containing the coordinates of the input boxes. Must be a rank 3 tensor of shape [N,B,4] of type [MPSDataTypeFloat32]

scoresTensor: A tensor containing the scores of the input boxes. Must be a rank 3 tensor of shape [N,B,1] of type [MPSDataTypeFloat32]

classIndicesTensor: A tensor containing the class indices of the input boxes. Must be a rank 2 tensor of shape [N,B] of type [MPSDataTypeInt32]

IOUThreshold: The threshold for when to reject boxes based on their Intersection Over Union. Valid range is [0,1].

scoreThreshold: The threshold for when to reject boxes based on their score, before IOU suppression.

perClassSuppression: When this is specified a box will only suppress another box if they have the same class.

coordinateMode: The coordinate mode the box coordinates are provided in.

name: The name for the operation.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/nonMaximumSuppression(withBoxesTensor:scoresTensor:classIndicesTensor:iouThreshold:scoreThreshold:perClassSuppression:coordinateMode:name:)

func (MPSGraph) NonMaximumSuppressionWithBoxesTensorScoresTensorIOUThresholdScoreThresholdPerClassSuppressionCoordinateModeName

func (g MPSGraph) NonMaximumSuppressionWithBoxesTensorScoresTensorIOUThresholdScoreThresholdPerClassSuppressionCoordinateModeName(boxesTensor IMPSGraphTensor, scoresTensor IMPSGraphTensor, IOUThreshold float32, scoreThreshold float32, perClassSuppression bool, coordinateMode MPSGraphNonMaximumSuppressionCoordinateMode, name string) IMPSGraphTensor

Creates a nonMaximumumSuppression operation and returns the result tensor.

boxesTensor: A tensor containing the coordinates of the input boxes. Must be a rank 3 tensor of shape [N,B,4] of type [MPSDataTypeFloat32]

scoresTensor: A tensor containing the scores of the input boxes. Must be a rank 3 tensor of shape [N,B,K] of type [MPSDataTypeFloat32]

IOUThreshold: The threshold for when to reject boxes based on their Intersection Over Union. Valid range is [0,1].

scoreThreshold: The threshold for when to reject boxes based on their score, before IOU suppression.

perClassSuppression: When this is specified a box will only suppress another box if they have the same class.

coordinateMode: The coordinate mode the box coordinates are provided in.

name: The name for the operation.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/nonMaximumSuppression(withBoxesTensor:scoresTensor:iouThreshold:scoreThreshold:perClassSuppression:coordinateMode:name:)

func (MPSGraph) NonZeroIndicesOfTensorName

func (g MPSGraph) NonZeroIndicesOfTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Computes the indices of the non-zero elements of the input tensor.

tensor: An MPSGraphTensor of which to compute the non-zero indices.

Return Value

A valid MPSGraphTensor containing indices in signed int32 data type.

Discussion

The indices are returned as a two-dimensional tensor of size `[number_of_nonzeros, input_rank]`. Each row in the result contains indices of a nonzero elements in input. For example:

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/nonZeroIndices(_:name:)

func (MPSGraph) NormalizationBetaGradientWithIncomingGradientTensorSourceTensorReductionAxesName

func (g MPSGraph) NormalizationBetaGradientWithIncomingGradientTensorSourceTensorReductionAxesName(incomingGradientTensor IMPSGraphTensor, sourceTensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor

Creates a normalization beta-gradient operation and returns the result tensor.

incomingGradientTensor: The incoming original `resultTensor` gradient.

sourceTensor: The original input source in forward direction.

axes: The axes of normalization.

name: An optional name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

The mean and variance tensors should be outputs of `name` and `name`. Use the axes parameter to achieve different types of normalizations. For example (assuming your data is in [NxHxWxC] format) Batch normalization: axes = [0, 1, 2] Instance normalization: axes = [1, 2]

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/normalizationBetaGradient(withIncomingGradientTensor:sourceTensor:reductionAxes:name:)

func (MPSGraph) NormalizationGammaGradientWithIncomingGradientTensorSourceTensorMeanTensorVarianceTensorReductionAxesEpsilonName

func (g MPSGraph) NormalizationGammaGradientWithIncomingGradientTensorSourceTensorMeanTensorVarianceTensorReductionAxesEpsilonName(incomingGradientTensor IMPSGraphTensor, sourceTensor IMPSGraphTensor, meanTensor IMPSGraphTensor, varianceTensor IMPSGraphTensor, axes []foundation.NSNumber, epsilon float32, name string) IMPSGraphTensor

Creates a normalization gamma-gradient operation and returns the result tensor.

incomingGradientTensor: The incoming original `resultTensor` gradient.

sourceTensor: The original input source in forward direction.

meanTensor: The mean tensor.

varianceTensor: The variance tensor.

axes: The axes of normalization.

epsilon: A small value to add to the variance when normalizing the inputs.

name: An optional name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

The mean and variance tensors should be outputs of `name` and `name`. Use the axes parameter to achieve different types of normalizations. For example (assuming your data is in [NxHxWxC] format) Batch normalization: axes = [0, 1, 2] Instance normalization: axes = [1, 2]

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/normalizationGammaGradient(withIncomingGradientTensor:sourceTensor:mean:varianceTensor:reductionAxes:epsilon:name:)

func (MPSGraph) NormalizationGradientWithIncomingGradientTensorSourceTensorMeanTensorVarianceTensorGammaTensorGammaGradientTensorBetaGradientTensorReductionAxesEpsilonName

func (g MPSGraph) NormalizationGradientWithIncomingGradientTensorSourceTensorMeanTensorVarianceTensorGammaTensorGammaGradientTensorBetaGradientTensorReductionAxesEpsilonName(incomingGradientTensor IMPSGraphTensor, sourceTensor IMPSGraphTensor, meanTensor IMPSGraphTensor, varianceTensor IMPSGraphTensor, gamma IMPSGraphTensor, gammaGradient IMPSGraphTensor, betaGradient IMPSGraphTensor, axes []foundation.NSNumber, epsilon float32, name string) IMPSGraphTensor

Creates a normalization input gradient operation and returns the result tensor.

incomingGradientTensor: The incoming original `resultTensor` gradient.

sourceTensor: The original input source in forward direction.

meanTensor: The mean tensor.

varianceTensor: The variance tensor.

gamma: The gamma tensor.

gammaGradient: The `gammaGradient` tensor.

betaGradient: The `betaGradient` tensor

axes: The axes of normalization.

epsilon: A small value to add to the variance when normalizing the inputs.

name: An optional name for the operation.

Discussion

The mean and variance tensors should be outputs of `name` and `name`. Use the axes parameter to achieve different types of normalizations. For example (assuming your data is in [NxHxWxC] format) Batch normalization: axes = [0, 1, 2] Instance normalization: axes = [1, 2]

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/normalizationGradient(withIncomingGradientTensor:sourceTensor:mean:varianceTensor:gammaTensor:gammaGradientTensor:betaGradientTensor:reductionAxes:epsilon:name:)

func (MPSGraph) NormalizationWithTensorMeanTensorVarianceTensorGammaTensorBetaTensorEpsilonName

func (g MPSGraph) NormalizationWithTensorMeanTensorVarianceTensorGammaTensorBetaTensorEpsilonName(tensor IMPSGraphTensor, mean IMPSGraphTensor, variance IMPSGraphTensor, gamma IMPSGraphTensor, beta IMPSGraphTensor, epsilon float32, name string) IMPSGraphTensor

Creates a batch normalization operation and returns the result tensor.

tensor: The input tensor.

mean: The mean tensor.

variance: The variance tensor.

gamma: The tensor used to scale the normalized result.

beta: The tensor used to bias the normalized result.

epsilon: A small value to add to the variance when normalizing the inputs.

name: An optional name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

The mean and variance tensors should be outputs of `name` and `name`. Use the axes parameter to achieve different types of normalizations. For example (assuming your data is in NxHxWxC format) Batch normalization: axes = [0, 1, 2] Instance normalization: axes = [1, 2] Shapes for gamma and beta must match the input data along at least one dimension and will be broadcast along the rest. For batch normalization, gamma and beta would typically be 1x1x1xC i.e. one value per channel.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/normalize(_:mean:variance:gamma:beta:epsilon:name:)

func (MPSGraph) NotEqualWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) NotEqualWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the elementwise inequality check of the input tensors.

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 not equal operation and returns the result tensor. It supports broadcasting as well.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/notEqual(_:_:name:)

func (MPSGraph) NotWithTensorName

func (g MPSGraph) NotWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies the logical NOT operation to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/not(with:name:)

func (MPSGraph) OneHotWithIndicesTensorDepthAxisDataTypeName

func (g MPSGraph) OneHotWithIndicesTensorDepthAxisDataTypeName(indicesTensor IMPSGraphTensor, depth uint, axis uint, dataType uint32, name string) IMPSGraphTensor

Creates a oneHot operation and returns the result tensor.

indicesTensor: Tensor of indices for on values

depth: Depth of the oneHot vector along the axis

axis: The axis to insert the new oneHot vector at

dataType: MPSDataType of the result tensor.

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

Discussion

Creates a tensor of rank equal to the rank of `indicesTensor` + 1. Inserts a new axis at the axis specified, or the minor axis if `axis` is -1. The values at the indices in the indicesTensor will be set to 1, and all other values will be set to 0.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/oneHot(withIndicesTensor:depth:axis:dataType:name:)

func (MPSGraph) OneHotWithIndicesTensorDepthAxisDataTypeOnValueOffValueName

func (g MPSGraph) OneHotWithIndicesTensorDepthAxisDataTypeOnValueOffValueName(indicesTensor IMPSGraphTensor, depth uint, axis uint, dataType uint32, onValue float64, offValue float64, name string) IMPSGraphTensor

Creates a oneHot operation and returns the result tensor.

indicesTensor: Tensor of indices for on values

depth: Depth of the oneHot vector along the axis

axis: The axis to insert the new oneHot vector at. Defaults to -1, the minor axis

dataType: MPSDataType of the result tensor Defaults to MPSDataTypeFloat

onValue: The value for indices designated by the indicesTensor. This value must match the specified data type. Defaults to 1.0f

offValue: The value for indices not designated by the indicesTensor. This value must match the specified data type. Defaults to 0.0f

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

Discussion

Creates a tensor of rank equal to the indicesTensor rank + 1. Inserts a new axis at the axis specified, or the minor axis if axis is -1. The values at the indices in the indicesTensor will have the onValue, and all other values will be set to the offValue.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/oneHot(withIndicesTensor:depth:axis:dataType:onValue:offValue:name:)

func (MPSGraph) OneHotWithIndicesTensorDepthAxisName

func (g MPSGraph) OneHotWithIndicesTensorDepthAxisName(indicesTensor IMPSGraphTensor, depth uint, axis uint, name string) IMPSGraphTensor

Creates a oneHot operation and returns the result tensor.

indicesTensor: Tensor of indices for on values

depth: Depth of the oneHot vector along the axis

axis: The axis to insert the new oneHot vector at

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

Discussion

Creates a tensor of rank equal to the rank of `indicesTensor` + 1, of type MPSDataTypeFloat32. Inserts a new axis at the axis specified, or the minor axis if `axis` is -1. The values at the indices in the indicesTensor will be set to 1, and all other values will be set to 0.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/oneHot(withIndicesTensor:depth:axis:name:)

func (MPSGraph) OneHotWithIndicesTensorDepthDataTypeName

func (g MPSGraph) OneHotWithIndicesTensorDepthDataTypeName(indicesTensor IMPSGraphTensor, depth uint, dataType uint32, name string) IMPSGraphTensor

Creates a oneHot operation and returns the result tensor.

indicesTensor: Tensor of indices for on values

depth: Depth of the oneHot vector along the axis

dataType: MPSDataType of the result tensor.

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

Discussion

Creates a tensor of rank equal to the rank of `indicesTensor` + 1. Inserts a new axis at the minor dimension. The values at the indices in the indicesTensor will be set to 1, and all other values will be set to 0.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/oneHot(withIndicesTensor:depth:dataType:name:)

func (MPSGraph) OneHotWithIndicesTensorDepthDataTypeOnValueOffValueName

func (g MPSGraph) OneHotWithIndicesTensorDepthDataTypeOnValueOffValueName(indicesTensor IMPSGraphTensor, depth uint, dataType uint32, onValue float64, offValue float64, name string) IMPSGraphTensor

Creates a oneHot operation and returns the result tensor.

indicesTensor: Tensor of indices for on values

depth: Depth of the oneHot vector along the axis

dataType: MPSDataType of the result tensor.

onValue: The value for indices designated by the indicesTensor. This value must match the specified data type.

offValue: The value for indices not designated by the indicesTensor. This value must match the specified data type.

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

Discussion

Creates a tensor of rank equal to the rank of `indicesTensor` + 1. Inserts a new axis at the minor dimension. The values at the indices in the indicesTensor will have the onValue, and all other values will be set to the offValue.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/oneHot(withIndicesTensor:depth:dataType:onValue:offValue:name:)

func (MPSGraph) OneHotWithIndicesTensorDepthName

func (g MPSGraph) OneHotWithIndicesTensorDepthName(indicesTensor IMPSGraphTensor, depth uint, name string) IMPSGraphTensor

Creates a oneHot operation and returns the result tensor.

indicesTensor: Tensor of indices for on values

depth: Depth of the oneHot vector along the axis

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

Discussion

Creates a tensor of rank equal to the rank of `indicesTensor` + 1, of type MPSDataTypeFloat32. Inserts a new axis at the minor dimension. The values at the indices in the indicesTensor will be set to 1, and all other values will be set to 0.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/oneHot(withIndicesTensor:depth:name:)

func (MPSGraph) Options

func (g MPSGraph) Options() MPSGraphOptions

Options for the graph.

Discussion

The default value is MPSGraphOptionsDefault.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/options

func (MPSGraph) PadGradientWithIncomingGradientTensorSourceTensorPaddingModeLeftPaddingRightPaddingName

func (g MPSGraph) PadGradientWithIncomingGradientTensorSourceTensorPaddingModeLeftPaddingRightPaddingName(incomingGradientTensor IMPSGraphTensor, sourceTensor IMPSGraphTensor, paddingMode MPSGraphPaddingMode, leftPadding foundation.NSArray, rightPadding foundation.NSArray, name string) IMPSGraphTensor

Creates a padding gradient operation and returns the result tensor.

incomingGradientTensor: The input gradient tensor.

sourceTensor: The input tensor of the forward pass.

paddingMode: The parameter that defines the padding mode.

leftPadding: The parameter that defines how much padding the operation applies to the input tensor before each dimension - must be of size `rank(tensor)`.

rightPadding: The parameter that defines how much padding the operation applies to the input tensor after each dimension - must be of size `rank(tensor)`.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/padGradient(withIncomingGradientTensor:sourceTensor:paddingMode:leftPadding:rightPadding:name:)

func (MPSGraph) PadTensorWithPaddingModeLeftPaddingRightPaddingConstantValueName

func (g MPSGraph) PadTensorWithPaddingModeLeftPaddingRightPaddingConstantValueName(tensor IMPSGraphTensor, paddingMode MPSGraphPaddingMode, leftPadding foundation.NSArray, rightPadding foundation.NSArray, constantValue float64, name string) IMPSGraphTensor

Creates a padding operation and returns the result tensor.

tensor: The input tensor.

paddingMode: The parameter that defines the padding mode.

leftPadding: The parameter that defines how much padding the operation applies to the input tensor before each dimension - must be of size `rank(tensor)`.

rightPadding: The parameter that defines how much padding the operation applies to the input tensor after each dimension - must be of size `rank(tensor)`.

constantValue: The constant value the operation uses when `paddingMode = MPSGraphPaddingModeConstant`.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/padTensor(_:with:leftPadding:rightPadding:constantValue:name:)

func (MPSGraph) PlaceholderTensors

func (g MPSGraph) PlaceholderTensors() []MPSGraphTensor

Array of all the placeholder tensors.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/placeholderTensors

func (MPSGraph) PlaceholderWithShapeDataTypeName

func (g MPSGraph) PlaceholderWithShapeDataTypeName(shape foundation.NSArray, dataType uint32, name string) IMPSGraphTensor

Creates a placeholder operation and returns the result tensor.

shape: The shape of the output tensor. A nil shape will result in an unranked tensor.

dataType: The dataType of the placeholder tensor.

name: The name for the placeholder operation.

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/placeholder(shape:dataType:name:)

func (MPSGraph) PlaceholderWithShapeName

func (g MPSGraph) PlaceholderWithShapeName(shape foundation.NSArray, name string) IMPSGraphTensor

Creates a placeholder operation and returns the result tensor with the dataType of the placeholder tensor set to 32 bit float.

shape: The shape of the output tensor. A nil shape will result in an unranked tensor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/placeholder(shape:name:)

func (MPSGraph) PowerWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) PowerWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the elementwise result of raising the first tensor to the power of the second tensor.

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 power operation and returns the result tensor. It supports broadcasting as well.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/power(_:_:name:)

func (MPSGraph) QuantizeTensorScaleTensorZeroPointDataTypeAxisName

func (g MPSGraph) QuantizeTensorScaleTensorZeroPointDataTypeAxisName(tensor IMPSGraphTensor, scaleTensor IMPSGraphTensor, zeroPoint float64, dataType uint32, axis int, name string) IMPSGraphTensor

Creates a Quantize operation and returns the result tensor.

tensor: Input tensor to be quantized

scaleTensor: Scale 1D Tensor parameter with size == tensor.shape[axis]

zeroPoint: Bias scalar parameter (converted to dataType of resultTensor)

dataType: Integer data type of the result tensor.

axis: Axis on which the scale 1D value is being broadcasted

name: The name for the operation.

Return Value

A valid MPSGraphTensor array of datatype dataType

Discussion

Convert the float `tensor` to an i8 or u8 tensor by applying a scale + bias transform: result = (tensor / scaleTensor) + zeroPoint

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/quantize(_:scaleTensor:zeroPoint:dataType:axis:name:)

func (MPSGraph) QuantizeTensorScaleTensorZeroPointTensorDataTypeAxisName

func (g MPSGraph) QuantizeTensorScaleTensorZeroPointTensorDataTypeAxisName(tensor IMPSGraphTensor, scaleTensor IMPSGraphTensor, zeroPointTensor IMPSGraphTensor, dataType uint32, axis int, name string) IMPSGraphTensor

Creates a Quantize operation and returns the result tensor.

tensor: Input tensor to be quantized

scaleTensor: Scale scalar or 1D Tensor parameter with size == tensor.shape[axis]

zeroPointTensor: Bias scalar or 1D Tensor parameter with size == tensor.shape[axis]

dataType: Integer data type of the result tensor.

axis: Axis on which the scale 1D value is being broadcasted

name: The name for the operation.

Return Value

A valid MPSGraphTensor array of datatype dataType

Discussion

Convert the float `tensor` to an i8 or u8 tensor by applying a scale + bias transform: result = (tensor / scaleTensor) + zeroPointTensor

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/quantize(_:scaleTensor:zeroPointTensor:dataType:axis:name:)

func (MPSGraph) QuantizeTensorScaleZeroPointDataTypeName

func (g MPSGraph) QuantizeTensorScaleZeroPointDataTypeName(tensor IMPSGraphTensor, scale float64, zeroPoint float64, dataType uint32, name string) IMPSGraphTensor

Creates a Quantize operation and returns the result tensor.

tensor: Input tensor to be quantized

scale: Scale scalar parameter

zeroPoint: Bias scalar parameter (converted to dataType of resultTensor)

dataType: Integer data type of the result tensor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array of datatype dataType

Discussion

Convert the float `tensor` to an i8 or u8 tensor by applying a scale + bias transform: result = (tensor / scale) + zeroPoint

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/quantize(_:scale:zeroPoint:dataType:name:)

func (MPSGraph) RandomPhiloxStateTensorWithCounterLowCounterHighKeyName

func (g MPSGraph) RandomPhiloxStateTensorWithCounterLowCounterHighKeyName(counterLow uint, counterHigh uint, key uint, name string) IMPSGraphTensor

Creates a tensor representing state using the Philox algorithm with given counter and key values.

counterLow: The value to initilaize lower 64 bits of counter to. Philox utilizes a 128 bit counter

counterHigh: The value to initilaize upper 64 bits of counter to. Philox utilizes a 128 bit counter

key: The value to initialize the key to in Philox algorithm.

name: Name for the operation

Return Value

An MPSGraphTensor representing a random state, to be passed as an input to a random op.

Discussion

See randomPhiloxStateTensorWithSeed.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/randomPhiloxStateTensor(withCounterLow:counterHigh:key:name:)

func (MPSGraph) RandomPhiloxStateTensorWithSeedName

func (g MPSGraph) RandomPhiloxStateTensorWithSeedName(seed uint, name string) IMPSGraphTensor

Creates a tensor representing state using the Philox algorithm with given counter and key values.

Discussion

Generates random numbers using the Philox counter-based algorithm, for further details see: John K. Salmon, Mark A. Moraes, Ron O. Dror, and David E. Shaw. Parallel Random Numbers: As Easy as 1, 2, 3. A stateTensor generated with this API can be used in MPSGraph Random APIs which accept a stateTensor. The updated stateTensor is returned alongside the random values, and can be fed to the following random layer. In most use cases, a stateTensor should only need to be initialized once at the start of the graph. A stateTensor can be set as a target tensor of an MPSGraph execution to obtain a stateTensor serialized as an NDArray. This can be used as input to a placeholder in the graph to avoid ever needing to have a state intilization layer in an MPSGraph. This can allow for a continued stream through multiple executions of a single MPSGraph by having the final stateTensor as a target tensor passed into the following MPSGraph execution as a placeholder input. This may be helpful for training graphs in particular.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/randomPhiloxStateTensor(withSeed:name:)

func (MPSGraph) RandomTensorWithShapeDescriptorName

func (g MPSGraph) RandomTensorWithShapeDescriptorName(shape foundation.NSArray, descriptor IMPSGraphRandomOpDescriptor, name string) IMPSGraphTensor

Creates a Random op of type matching distribution in descriptor and returns random values.

shape: The shape of the tensor generated

descriptor: The descriptor of the distribution. See MPSGraphRandomOpDescriptor.

name: The name for the operation.

Return Value

An MPSGraphTensor of shape containing random values in the defined range.

Discussion

Returns a tensor of provided shape of random values in the distribution specified. Uses a random seed value to initalize state. No state is preserved, and subsequent calls are not guaranteed to result in a unique stream of random values.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/randomTensor(withShape:descriptor:name:)

func (MPSGraph) RandomTensorWithShapeDescriptorSeedName

func (g MPSGraph) RandomTensorWithShapeDescriptorSeedName(shape foundation.NSArray, descriptor IMPSGraphRandomOpDescriptor, seed uint, name string) IMPSGraphTensor

Creates a Random op of type matching distribution in descriptor and returns random values.

shape: The shape of the tensor generated

descriptor: The descriptor of the distribution. See MPSGraphRandomOpDescriptor.

seed: The seed to use to initialize state. All calls with equal seed yield an identical stream of random values.

name: The name for the operation.

Return Value

An MPSGraphTensor of shape containing random values in the defined range.

Discussion

Returns a tensor of provided shape of random values in the distribution specified. Uses the provided seed value to initalize state. No state is preserved, and all calls with equal seed yield an identical stream of random values.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/randomTensor(withShape:descriptor:seed:name:)

func (MPSGraph) RandomTensorWithShapeDescriptorStateTensorName

func (g MPSGraph) RandomTensorWithShapeDescriptorStateTensorName(shape foundation.NSArray, descriptor IMPSGraphRandomOpDescriptor, state IMPSGraphTensor, name string) []MPSGraphTensor

Creates a Random op of type matching distribution in descriptor, and returns random values and updated state.

shape: The shape of the tensor generated

descriptor: The descriptor of the distribution. See MPSGraphRandomOpDescriptor.

state: The state to define a stream of random values. All calls with equal state yield an identical stream of random values.

name: The name for the operation.

Return Value

An array of MPSGraphTensor of size 2. The first MPSGraphTensor is of shape containing random values in the defined range. The second MPSGraphTensor is the updated state tensor.

Discussion

Returns an array of 2 tensors, where the first is of provided shape of random values in the distribution specified, and the second is the updated state tensor. Uses the provided state to define a stream of random values. No state is preserved, and all calls with equal state yield an identical stream of random values. The initial stateTensor provided should be created using the MPSGraph randomPhiloxStateTensor APIs. The resulting stateTensor from this op can be passed as an argument to the following random calls to continue sampling from the stream.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/randomTensor(withShape:descriptor:stateTensor:name:)

func (MPSGraph) RandomTensorWithShapeTensorDescriptorName

func (g MPSGraph) RandomTensorWithShapeTensorDescriptorName(shapeTensor IMPSGraphTensor, descriptor IMPSGraphRandomOpDescriptor, name string) IMPSGraphTensor

Creates a Random op of type matching distribution in descriptor and returns random values.

shapeTensor: 1D Int32 or Int64 tensor. The shape of the tensor generated

descriptor: The descriptor of the distribution. See MPSGraphRandomOpDescriptor.

name: The name for the operation.

Return Value

An MPSGraphTensor of shape containing random values in the defined range.

Discussion

Returns a tensor of provided shape of random values in the distribution specified. Uses a random seed value to initalize state. No state is preserved, and subsequent calls are not guaranteed to result in a unique stream of random values.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/randomTensor(withShapeTensor:descriptor:name:)

func (MPSGraph) RandomTensorWithShapeTensorDescriptorSeedName

func (g MPSGraph) RandomTensorWithShapeTensorDescriptorSeedName(shapeTensor IMPSGraphTensor, descriptor IMPSGraphRandomOpDescriptor, seed uint, name string) IMPSGraphTensor

Creates a Random op of type matching distribution in descriptor and returns random values.

shapeTensor: 1D Int32 or Int64 tensor. The shape of the tensor generated

descriptor: The descriptor of the distribution. See MPSGraphRandomOpDescriptor.

seed: The seed to use to initialize state. All calls with equal seed yield an identical stream of random values.

name: The name for the operation.

Return Value

An MPSGraphTensor of shape containing random values in the defined range.

Discussion

Returns a tensor of provided shape of random values in the distribution specified. Uses the provided seed value to initalize state. No state is preserved, and all calls with equal seed yield an identical stream of random values.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/randomTensor(withShapeTensor:descriptor:seed:name:)

func (MPSGraph) RandomTensorWithShapeTensorDescriptorStateTensorName

func (g MPSGraph) RandomTensorWithShapeTensorDescriptorStateTensorName(shapeTensor IMPSGraphTensor, descriptor IMPSGraphRandomOpDescriptor, state IMPSGraphTensor, name string) []MPSGraphTensor

Creates a Random op of type matching distribution in descriptor, and returns random values and updated state.

shapeTensor: 1D Int32 or Int64 tensor. The shape of the tensor generated.

descriptor: The descriptor of the distribution. See MPSGraphRandomOpDescriptor.

state: The state to define a stream of random values. All calls with equal state yield an identical stream of random values.

name: The name for the operation.

Return Value

An array of MPSGraphTensor of size 2. The first MPSGraphTensor is of shape containing random values in the defined range. The second MPSGraphTensor is the updated state tensor.

Discussion

Returns an array of 2 tensors, where the first is of provided shape of random values in the distribution specified, and the second is the updated state tensor. Uses the provided state to define a stream of random values. No state is preserved, and all calls with equal state yield an identical stream of random values. The initial stateTensor provided should be created using the MPSGraph randomPhiloxStateTensor APIs. The resulting stateTensor from this op can be passed as an argument to the following random calls to continue sampling from the stream.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/randomTensor(withShapeTensor:descriptor:stateTensor:name:)

func (MPSGraph) RandomUniformTensorWithShapeName

func (g MPSGraph) RandomUniformTensorWithShapeName(shape foundation.NSArray, name string) IMPSGraphTensor

Creates a RandomUniform operation and returns random uniform values

shape: The shape of the tensor generated

name: The name for the operation.

Return Value

An MPSGraphTensor of shape containing random values in the defined range.

Discussion

Returns a tensor of provided shape of random uniform values in the range [0.0, 1.0). Uses a random seed value to initalize state. No state is preserved, and subsequent calls are not guaranteed to result in a unique stream of random values.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/randomUniformTensor(withShape:name:)

func (MPSGraph) RandomUniformTensorWithShapeSeedName

func (g MPSGraph) RandomUniformTensorWithShapeSeedName(shape foundation.NSArray, seed uint, name string) IMPSGraphTensor

Creates a RandomUniform operation and returns random uniform values

shape: The shape of the tensor generated

seed: The seed to use to initialize state. All calls with equal seed yield an identical stream of random values.

name: The name for the operation.

Return Value

An MPSGraphTensor of shape containing random values in the defined range.

Discussion

Returns a tensor of provided shape of random uniform values in the range [0.0, 1.0). Uses the provided seed value to initalize state. No state is preserved, and all calls with equal seed yield an identical stream of random values.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/randomUniformTensor(withShape:seed:name:)

func (MPSGraph) RandomUniformTensorWithShapeStateTensorName

func (g MPSGraph) RandomUniformTensorWithShapeStateTensorName(shape foundation.NSArray, state IMPSGraphTensor, name string) []MPSGraphTensor

Creates a RandomUniform operation and returns random uniform values and updated state

shape: The shape of the tensor generated

state: The state to define a stream of random values. All calls with equal state yield an identical stream of random values.

name: The name for the operation.

Return Value

An array of MPSGraphTensor of size 2. The first MPSGraphTensor is of shape containing random values in the defined range. The second MPSGraphTensor is the updated state tensor.

Discussion

Returns an array of 2 tensors, where the first is a tensor of provided shape of random uniform values in the range [0.0, 1.0), and the second is the updated state tensor. The provided state is used to define a stream of random values. No state is preserved, and all calls with equal state yield an identical stream of random values. The initial stateTensor provided should be created using the MPSGraph randomPhiloxStateTensor APIs. The resulting stateTensor from this op can be passed as an argument to the following random calls to continue sampling from the stream.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/randomUniformTensor(withShape:stateTensor:name:)

func (MPSGraph) RandomUniformTensorWithShapeTensorName

func (g MPSGraph) RandomUniformTensorWithShapeTensorName(shapeTensor IMPSGraphTensor, name string) IMPSGraphTensor

Creates a RandomUniform operation and returns random uniform values

shapeTensor: 1D Int32 or Int64 tensor. The shape of the tensor generated

name: The name for the operation.

Return Value

An MPSGraphTensor of shape containing random values in the defined range.

Discussion

Returns a tensor of provided shape of random uniform values in the range [0.0, 1.0). Uses a random seed value to initalize state. No state is preserved, and subsequent calls are not guaranteed to result in a unique stream of random values.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/randomUniformTensor(withShapeTensor:name:)

func (MPSGraph) RandomUniformTensorWithShapeTensorSeedName

func (g MPSGraph) RandomUniformTensorWithShapeTensorSeedName(shapeTensor IMPSGraphTensor, seed uint, name string) IMPSGraphTensor

Creates a RandomUniform operation and returns random uniform values

shapeTensor: 1D Int32 or Int64 tensor. The shape of the tensor generated

seed: The seed to use to initialize state. All calls with equal seed yield an identical stream of random values.

name: The name for the operation.

Return Value

An MPSGraphTensor of shape containing random values in the defined range.

Discussion

Returns a tensor of provided shape of random uniform values in the range [0.0, 1.0). Uses the provided seed value to initalize state. No state is preserved, and all calls with equal seed yield an identical stream of random values.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/randomUniformTensor(withShapeTensor:seed:name:)

func (MPSGraph) RandomUniformTensorWithShapeTensorStateTensorName

func (g MPSGraph) RandomUniformTensorWithShapeTensorStateTensorName(shapeTensor IMPSGraphTensor, state IMPSGraphTensor, name string) []MPSGraphTensor

Creates a RandomUniform operation and returns random uniform values and updated state

shapeTensor: 1D Int32 or Int64 tensor. The shape of the tensor generated

state: The state to define a stream of random values. All calls with equal state yield an identical stream of random values.

name: The name for the operation.

Return Value

An array of MPSGraphTensor of size 2. The first MPSGraphTensor is of shape containing random values in the defined range. The second MPSGraphTensor is the updated state tensor.

Discussion

Returns an array of 2 tensors, where the first is a tensor of provided shape of random uniform values in the range [0.0, 1.0), and the second is the updated state tensor. The provided state is used to define a stream of random values. No state is preserved, and all calls with equal state yield an identical stream of random values. The initial stateTensor provided should be created using the MPSGraph randomPhiloxStateTensor APIs. The resulting stateTensor from this op can be passed as an argument to the following random calls to continue sampling from the stream.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/randomUniformTensor(withShapeTensor:stateTensor:name:)

func (MPSGraph) ReLUGradientWithIncomingGradientSourceTensorName

func (g MPSGraph) ReLUGradientWithIncomingGradientSourceTensorName(gradient IMPSGraphTensor, source IMPSGraphTensor, name string) IMPSGraphTensor

Computes the gradient of the ReLU (rectified linear activation unit) function using the incoming gradient.

gradient: The incoming gradient tensor.

source: The input tensor from forward pass.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reLUGradient(withIncomingGradient:sourceTensor:name:)

func (MPSGraph) ReLUWithTensorName

func (g MPSGraph) ReLUWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Computes the ReLU (rectified linear activation unit) function with the input tensor.

tensor: The input tensor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

The operation is: f(x) = max(x, 0).

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reLU(with:name:)

func (MPSGraph) ReadVariableName

func (g MPSGraph) ReadVariableName(variable IMPSGraphTensor, name string) IMPSGraphTensor

Creates a read op which reads at this point of execution of the graph and returns the result tensor.

variable: The variable resource tensor to read from.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/read(_:name:)

func (MPSGraph) RealPartOfTensorName

func (g MPSGraph) RealPartOfTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the real part of a tensor.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/realPartOfTensor(tensor:name:)

func (MPSGraph) RealToHermiteanFFTWithTensorAxesDescriptorName

func (g MPSGraph) RealToHermiteanFFTWithTensorAxesDescriptorName(tensor IMPSGraphTensor, axes []foundation.NSNumber, descriptor IMPSGraphFFTDescriptor, name string) IMPSGraphTensor

Creates a Real-to-Hermitean fast Fourier transform operation and returns the result tensor.

tensor: A Real-valued input tensor. Must have datatype [MPSDataTypeFloat32] or [MPSDatatypeFloat16].

axes: An array of numbers that specifies over which axes MPSGraph performs the Fourier transform - all axes must be contained within last four dimensions of the input tensor.

descriptor: A descriptor that defines the parameters of the Fourier transform operation - see MPSGraphFFTDescriptor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor of type [MPSDataTypeComplexFloat32] or [MPSDataTypeComplexFloat16] with reduced size (see Discussion).

Discussion

This operation computes the fast Fourier transform of a real-valued input tensor according to the following formulae.

`scale = 1` for `scaling_mode = none`, `scale = 1/V_f` for `scaling_mode = size`, `scale = 1/sqrt(V_f)` for `scaling_mode = unitary`, where `V_f` is the volume of the transformation defined by the dimensions included in `axes` (`V_f = prod_{i \in axes} shape(input)[i]`) (see MPSGraphFFTDescriptor.ScalingMode), `+` is selected in `+/-` when `inverse` is specified, otherwise `-` is used and the sum is done separately over each dimension in `axes` and `n` is the dimension length of that axis. With this API MPSGraph writes out only the results for the unique frequencies, resulting in a tensor which has size `(n/2)+1` in the last dimension defined by `axes`.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/realToHermiteanFFT(_:axes:descriptor:name:)

func (MPSGraph) RealToHermiteanFFTWithTensorAxesTensorDescriptorName

func (g MPSGraph) RealToHermiteanFFTWithTensorAxesTensorDescriptorName(tensor IMPSGraphTensor, axesTensor IMPSGraphTensor, descriptor IMPSGraphFFTDescriptor, name string) IMPSGraphTensor

Creates a Real-to-Hermitean fast Fourier transform operation and returns the result tensor.

tensor: A real-valued input tensor. Must have datatype [MPSDataTypeFloat32] or [MPSDatatypeFloat16].

axesTensor: A tensor of rank one containing the axes over which MPSGraph performs the transformation. See MPSGraph.FastFourierTransformWithTensorAxesDescriptorName.

descriptor: A descriptor that defines the parameters of the Fourier transform operation - see MPSGraphFFTDescriptor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor of type [MPSDataTypeComplexFloat32] or [MPSDataTypeComplexFloat16] with reduced size (see Discussion).

Discussion

This operation computes the fast Fourier transform of a real-valued input tensor according to the following formulae.

`scale = 1` for `scaling_mode = none`, `scale = 1/V_f` for `scaling_mode = size`, `scale = 1/sqrt(V_f)` for `scaling_mode = unitary`, where `V_f` is the volume of the transformation defined by the dimensions included in `axes` (`V_f = prod_{i \in axes} shape(input)[i]`) (see MPSGraphFFTDescriptor.ScalingMode), `+` is selected in `+/-` when `inverse` is specified, otherwise `-` is used and the sum is done separately over each dimension in `axes` and `n` is the dimension length of that axis. With this API MPSGraph writes out only the results for the unique frequencies, resulting in a tensor which has size `(n/2)+1` in the last dimension defined by `axes`.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/realToHermiteanFFT(_:axesTensor:descriptor:name:)

func (MPSGraph) ReciprocalSquareRootWithTensorName

func (g MPSGraph) ReciprocalSquareRootWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies the reciprocal square root operation to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reciprocalSquareRoot(_:name:)

func (MPSGraph) ReciprocalWithTensorName

func (g MPSGraph) ReciprocalWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies the reciprocal operation to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reciprocal(with:name:)

func (MPSGraph) ReductionAndWithTensorAxesName

func (g MPSGraph) ReductionAndWithTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor

Creates a reduction and operation and returns the result tensor.

tensor: Input tensor

axes: Axes of reduction

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reductionAnd(with:axes:name:)

func (MPSGraph) ReductionAndWithTensorAxisName

func (g MPSGraph) ReductionAndWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor

Creates a reduction and operation and returns the result tensor.

tensor: Input tensor

axis: Axis of reduction

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reductionAnd(with:axis:name:)

func (MPSGraph) ReductionArgMaximumWithTensorAxisName

func (g MPSGraph) ReductionArgMaximumWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor

Creates a reduction argMax operation and returns the result tensor.

tensor: Input tensor

axis: Axis of reduction

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reductionArgMaximum(with:axis:name:)

func (MPSGraph) ReductionArgMinimumWithTensorAxisName

func (g MPSGraph) ReductionArgMinimumWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor

Creates a reduction argMin operation and returns the result tensor.

tensor: Input tensor

axis: Axis of reduction

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reductionArgMinimum(with:axis:name:)

func (MPSGraph) ReductionMaximumPropagateNaNWithTensorAxesName

func (g MPSGraph) ReductionMaximumPropagateNaNWithTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor

Creates a reduction max propagate NaN operation and returns the result tensor.

tensor: Input tensor

axes: Axes of reduction

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reductionMaximumPropagateNaN(with:axes:name:)

func (MPSGraph) ReductionMaximumPropagateNaNWithTensorAxisName

func (g MPSGraph) ReductionMaximumPropagateNaNWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor

Creates a reduction max propagate NaN operation and returns the result tensor.

tensor: Input tensor

axis: Axis of reduction

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reductionMaximumPropagateNaN(with:axis:name:)

func (MPSGraph) ReductionMaximumWithTensorAxesName

func (g MPSGraph) ReductionMaximumWithTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor

Creates a reduction max operation and returns the result tensor.

tensor: Input tensor

axes: Axes of reduction

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reductionMaximum(with:axes:name:)

func (MPSGraph) ReductionMaximumWithTensorAxisName

func (g MPSGraph) ReductionMaximumWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor

Creates a reduction max operation and returns the result tensor.

tensor: Input tensor

axis: Axis of reduction

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reductionMaximum(with:axis:name:)

func (MPSGraph) ReductionMinimumPropagateNaNWithTensorAxesName

func (g MPSGraph) ReductionMinimumPropagateNaNWithTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor

Creates a reduction min propagate NaN operation and returns the result tensor.

tensor: Input tensor

axes: Axes of reduction

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reductionMinimumPropagateNaN(with:axes:name:)

func (MPSGraph) ReductionMinimumPropagateNaNWithTensorAxisName

func (g MPSGraph) ReductionMinimumPropagateNaNWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor

Creates a reduction min propagate NaN operation and returns the result tensor.

tensor: Input tensor

axis: Axis of reduction

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reductionMinimumPropagateNaN(with:axis:name:)

func (MPSGraph) ReductionMinimumWithTensorAxesName

func (g MPSGraph) ReductionMinimumWithTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor

Creates a reduction min operation and returns the result tensor.

tensor: Input tensor

axes: Axes of reduction

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reductionMinimum(with:axes:name:)

func (MPSGraph) ReductionMinimumWithTensorAxisName

func (g MPSGraph) ReductionMinimumWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor

Creates a reduction minimum operation and returns the result tensor.

tensor: Input tensor

axis: Axis of reduction

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reductionMinimum(with:axis:name:)

func (MPSGraph) ReductionOrWithTensorAxesName

func (g MPSGraph) ReductionOrWithTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor

Creates a reduction or operation and returns the result tensor.

tensor: Input tensor

axes: Axes of reduction

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reductionOr(with:axes:name:)

func (MPSGraph) ReductionOrWithTensorAxisName

func (g MPSGraph) ReductionOrWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor

Creates a reduction or operation and returns the result tensor.

tensor: Input tensor

axis: Axis of reduction

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reductionOr(with:axis:name:)

func (MPSGraph) ReductionProductWithTensorAxesName

func (g MPSGraph) ReductionProductWithTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor

Creates a reduction product operation and returns the result tensor.

tensor: Input tensor

axes: Axes of reduction

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reductionProduct(with:axes:name:)

func (MPSGraph) ReductionProductWithTensorAxisName

func (g MPSGraph) ReductionProductWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor

Creates a reduction product operation and returns the result tensor.

tensor: Input tensor

axis: Axis of reduction

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reductionProduct(with:axis:name:)

func (MPSGraph) ReductionSumWithTensorAxesName

func (g MPSGraph) ReductionSumWithTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor

Creates a reduction sum operation and returns the result tensor.

tensor: Input tensor

axes: Axes of reduction

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reductionSum(with:axes:name:)

func (MPSGraph) ReductionSumWithTensorAxisName

func (g MPSGraph) ReductionSumWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor

Creates a reduction sum operation and returns the result tensor.

tensor: Input tensor

axis: Axis of reduction

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reductionSum(with:axis:name:)

func (MPSGraph) ReinterpretCastTensorToTypeName

func (g MPSGraph) ReinterpretCastTensorToTypeName(tensor IMPSGraphTensor, type_ uint32, name string) IMPSGraphTensor

Creates a reinterpret cast operation and returns the result tensor.

tensor: The input tensor.

type: The element type of the returned tensor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Returns input tensor (with element type `tensor_type`) reinterpreted to element type passed in with the last dimension scaled by `sizeof(tensor_type) / sizeof(type)`. This operation is endianness agnostic and MPSGraph reinterprets the data with the endianness of the system.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reinterpretCast(_:to:name:)

func (MPSGraph) ReshapeTensorWithShapeName

func (g MPSGraph) ReshapeTensorWithShapeName(tensor IMPSGraphTensor, shape foundation.NSArray, name string) IMPSGraphTensor

Creates a reshape operation and returns the result tensor.

tensor: The tensor to be reshaped.

shape: The result tensor shape.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

This operation reshapes the input tensor to the target shape. The shape must be compatible with the input tensor shape, specifically the volume of the input tensor has to match the volume defined by the shape. The shape is allowed to contain dynamic dimensions (-1) when the result type can be inferred unambiguously.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reshape(_:shape:name:)

func (MPSGraph) ReshapeTensorWithShapeTensorName

func (g MPSGraph) ReshapeTensorWithShapeTensorName(tensor IMPSGraphTensor, shapeTensor IMPSGraphTensor, name string) IMPSGraphTensor

Creates a reshape operation and returns the result tensor.

tensor: The tensor to be reshaped.

shapeTensor: A 1D tensor of type [MPSDataTypeInt32] or [MPSDataTypeInt64], that contains the target shape values.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

This operation reshapes the input tensor to the target shape. The shape tensor must be compatible with the input tensor shape, specifically the volume of the input tensor has to match the volume defined by the shape tensor. The shape tensor is allowed to contain dynamic dimensions (-1) when the result type can be inferred unambiguously.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reshape(_:shapeTensor:name:)

func (MPSGraph) ResizeBilinearWithGradientTensorInputCenterResultAlignCornersLayoutName

func (g MPSGraph) ResizeBilinearWithGradientTensorInputCenterResultAlignCornersLayoutName(gradient IMPSGraphTensor, input IMPSGraphTensor, centerResult bool, alignCorners bool, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor

Creates a Resize gradient operation and returns the result tensor.

gradient: Incoming gradient tensor

input: Forward pass input tensor

centerResult: Controls if the result image is centered on the input image. When NO, the result will have the top left corner aligned

alignCorners: When YES, the result image will have the same value as the input image in the corners

layout: Specifies what layout the provided tensor is in. The returned tensor will follow the same layout. Valid layouts are NHWC, NCHW, HWC, CHW, and HW.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Computes the gradient for the forward pass Resize op with identical parameters. See discussion of resizeTensor for more in depth description of resize paramters.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/resizeBilinear(withGradientTensor:input:centerResult:alignCorners:layout:name:)

func (MPSGraph) ResizeBilinearWithGradientTensorInputScaleOffsetTensorLayoutName

func (g MPSGraph) ResizeBilinearWithGradientTensorInputScaleOffsetTensorLayoutName(gradient IMPSGraphTensor, input IMPSGraphTensor, scaleOffset IMPSGraphTensor, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor

Creates a Resize gradient operation and returns the result tensor.

gradient: Incoming gradient tensor

input: Forward pass input tensor

scaleOffset: 1D float tensor. A 4-element shape as [scaleY, scaleX, offsetY, offsetX]

layout: Specifies what layout the provided tensor is in. The returned tensor will follow the same layout. Valid layouts are NHWC, NCHW, HWC, CHW, and HW.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Computes the gradient for the forward pass Resize op with bilinear sampling and identical parameters. See discussion of resizeTensor for more in depth description of resize paramters.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/resizeBilinear(withGradientTensor:input:scaleOffsetTensor:layout:name:)

func (MPSGraph) ResizeBilinearWithGradientTensorInputScaleTensorOffsetTensorName

func (g MPSGraph) ResizeBilinearWithGradientTensorInputScaleTensorOffsetTensorName(gradient IMPSGraphTensor, input IMPSGraphTensor, scale IMPSGraphTensor, offset IMPSGraphTensor, name string) IMPSGraphTensor

Creates a Resize gradient operation and returns the result tensor.

gradient: Incoming gradient tensor

input: Forward pass input tensor

scale: 1D float tensor of size equal to rank of input.

offset: 1D float tensor of size equal to rank of input.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Computes the gradient for the forward pass Resize op with bilinear sampling and identical parameters.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/resizeBilinear(withGradientTensor:input:scale:offsetTensor:name:)

func (MPSGraph) ResizeBilinearWithTensorSizeTensorCenterResultAlignCornersLayoutName

func (g MPSGraph) ResizeBilinearWithTensorSizeTensorCenterResultAlignCornersLayoutName(imagesTensor IMPSGraphTensor, size IMPSGraphTensor, centerResult bool, alignCorners bool, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor

Resamples input images to given size using bilinear sampling.

imagesTensor: Tensor containing input images.

size: 1D Int32 or Int64 tensor. A 2-element shape as [newHeight, newWidth]

centerResult: Controls if the result image is centered on the input image. When NO, the result will have the top left corner aligned

alignCorners: When YES, the result image will have the same value as the input image in the corners

layout: Specifies what layout the provided tensor is in. The returned tensor will follow the same layout. Valid layouts are NHWC, NCHW, HWC, CHW, and HW.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Resamples input images to given size using nearest neighbor sampling. Result images will be distorted if size is of different aspect ratio. Destination indices are computed using direct index scaling by default, with no offset added. If the centerResult parameter is true, the destination indices will be scaled and shifted to be centered on the input image. If the alignCorners parameter is true, the corners of the result images will match the input images. Scaling will be modified to a factor of (size - 1) / (inputSize - 1). When alignCorners is true, the centerResult parameter does nothing. In order to achieve the same behavior as OpenCV’s resize and TensorFlowV2’s resize,

To achieve the same behavior as TensorFlowV1 resize

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/resizeBilinear(_:sizeTensor:centerResult:alignCorners:layout:name:)

func (MPSGraph) ResizeBilinearWithTensorSizeTensorCenterResultAlignCornersName

func (g MPSGraph) ResizeBilinearWithTensorSizeTensorCenterResultAlignCornersName(imagesTensor IMPSGraphTensor, size IMPSGraphTensor, centerResult bool, alignCorners bool, name string) IMPSGraphTensor

Creates a Resize operation and returns the result tensor.

imagesTensor: Tensor containing input images.

size: The target size of the result tensor. 1D Int32 or Int64 tensor of size equal to rank of input.

centerResult: Controls if the result image is centered on the input image. When NO, the result will have the top left corner aligned

alignCorners: When YES, the result image will have the same value as the input image in the corners

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Resamples input images to given size using bilinear sampling. Result images will be distorted if size is of different aspect ratio. Destination indices are computed using direct index scaling by default, with no offset added. If the centerResult parameter is true, the destination indices will be scaled and shifted to be centered on the input image. If the alignCorners parameter is true, the corners of the result images will match the input images. Scaling will be modified to a factor of (size - 1) / (inputSize - 1). When alignCorners is true, the centerResult parameter does nothing. In order to achieve the same behavior as OpenCV’s resize and TensorFlowV2’s resize,

To achieve the same behavior as TensorFlowV1 resize

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/resizeBilinear(_:sizeTensor:centerResult:alignCorners:name:)

func (MPSGraph) ResizeBilinearWithTensorSizeTensorScaleOffsetTensorLayoutName

func (g MPSGraph) ResizeBilinearWithTensorSizeTensorScaleOffsetTensorLayoutName(imagesTensor IMPSGraphTensor, size IMPSGraphTensor, scaleOffset IMPSGraphTensor, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor

Resamples input images to given size using the provided scale and offset and bilinear sampling See above discussion for more details.

imagesTensor: Tensor containing input images.

size: 1D Int32 or Int64 tensor. A 2-element shape as [newHeight, newWidth]

scaleOffset: 1D float tensor. A 4-element shape as [scaleY, scaleX, offsetY, offsetX]

layout: Specifies what layout the provided tensor is in. The returned tensor will follow the same layout. Valid layouts are NHWC, NCHW, HWC, CHW, and HW.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/resizeBilinear(_:sizeTensor:scaleOffsetTensor:layout:name:)

func (MPSGraph) ResizeBilinearWithTensorSizeTensorScaleTensorOffsetTensorName

func (g MPSGraph) ResizeBilinearWithTensorSizeTensorScaleTensorOffsetTensorName(imagesTensor IMPSGraphTensor, size IMPSGraphTensor, scale IMPSGraphTensor, offset IMPSGraphTensor, name string) IMPSGraphTensor

Creates a Resize operation and returns the result tensor.

imagesTensor: Tensor containing input images.

size: The target size of the result tensor. 1D Int32 or Int64 tensor of size equal to rank of input.

scale: 1D float tensor of size equal to rank of input.

offset: 1D float tensor of size equal to rank of input.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Resamples input images to given size using the provided scale and offset and bilinear sampling. Destination indices are computed using

For most use cases passing the scale and offset directly is unnecessary, and it is preferable to use the API specifying centerResult and alignCorners.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/resizeBilinear(_:sizeTensor:scaleTensor:offsetTensor:name:)

func (MPSGraph) ResizeNearestWithGradientTensorInputNearestRoundingModeCenterResultAlignCornersLayoutName

func (g MPSGraph) ResizeNearestWithGradientTensorInputNearestRoundingModeCenterResultAlignCornersLayoutName(gradient IMPSGraphTensor, input IMPSGraphTensor, nearestRoundingMode MPSGraphResizeNearestRoundingMode, centerResult bool, alignCorners bool, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor

Creates a Resize gradient operation and returns the result tensor.

gradient: Incoming gradient tensor

input: Forward pass input tensor

nearestRoundingMode: The rounding mode to use when using nearest resampling.

centerResult: Controls if the result image is centered on the input image. When NO, the result will have the top left corner aligned

alignCorners: When YES, the result image will have the same value as the input image in the corners

layout: Specifies what layout the provided tensor is in. The returned tensor will follow the same layout. Valid layouts are NHWC, NCHW, HWC, CHW, and HW.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Computes the gradient for the forward pass Resize op with identical parameters. See discussion of resizeTensor for more in depth description of resize paramters.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/resizeNearest(withGradientTensor:input:nearestRoundingMode:centerResult:alignCorners:layout:name:)

func (MPSGraph) ResizeNearestWithGradientTensorInputScaleOffsetTensorNearestRoundingModeLayoutName

func (g MPSGraph) ResizeNearestWithGradientTensorInputScaleOffsetTensorNearestRoundingModeLayoutName(gradient IMPSGraphTensor, input IMPSGraphTensor, scaleOffset IMPSGraphTensor, nearestRoundingMode MPSGraphResizeNearestRoundingMode, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor

Creates a Resize gradient operation and returns the result tensor.

gradient: Incoming gradient tensor

input: Forward pass input tensor

scaleOffset: 1D float tensor. A 4-element shape as [scaleY, scaleX, offsetY, offsetX]

nearestRoundingMode: The rounding mode to use when using nearest resampling.

layout: Specifies what layout the provided tensor is in. The returned tensor will follow the same layout. Valid layouts are NHWC, NCHW, HWC, CHW, and HW.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Computes the gradient for the forward pass Resize op with identical parameters. See discussion of resizeTensor for more in depth description of resize paramters.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/resizeNearest(withGradientTensor:input:scaleOffsetTensor:nearestRoundingMode:layout:name:)

func (MPSGraph) ResizeNearestWithGradientTensorInputScaleTensorOffsetTensorNearestRoundingModeName

func (g MPSGraph) ResizeNearestWithGradientTensorInputScaleTensorOffsetTensorNearestRoundingModeName(gradient IMPSGraphTensor, input IMPSGraphTensor, scale IMPSGraphTensor, offset IMPSGraphTensor, nearestRoundingMode MPSGraphResizeNearestRoundingMode, name string) IMPSGraphTensor

Creates a Resize gradient operation and returns the result tensor.

gradient: Incoming gradient tensor

input: Forward pass input tensor

scale: 1D float tensor of size equal to rank of input.

offset: 1D float tensor of size equal to rank of input.

nearestRoundingMode: The rounding mode to use when using nearest resampling. Default is roundPreferCeil.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Computes the gradient for the forward pass Resize op with nearest neighbor sampling and identical parameters. See discussion of resizeTensor for more in depth description of resize paramters.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/resizeNearest(withGradientTensor:input:scale:offsetTensor:nearestRoundingMode:name:)

func (MPSGraph) ResizeNearestWithTensorSizeTensorNearestRoundingModeCenterResultAlignCornersLayoutName

func (g MPSGraph) ResizeNearestWithTensorSizeTensorNearestRoundingModeCenterResultAlignCornersLayoutName(imagesTensor IMPSGraphTensor, size IMPSGraphTensor, nearestRoundingMode MPSGraphResizeNearestRoundingMode, centerResult bool, alignCorners bool, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor

Resamples input images to given size using nearest neighbor sampling.

imagesTensor: Tensor containing input images.

size: 1D Int32 or Int64 tensor. A 2-element shape as [newHeight, newWidth]

nearestRoundingMode: The rounding mode to use when using nearest resampling. Default is roundPreferCeil.

centerResult: Controls if the result image is centered on the input image. When NO, the result will have the top left corner aligned

alignCorners: When YES, the result image will have the same value as the input image in the corners

layout: Specifies what layout the provided tensor is in. The returned tensor will follow the same layout. Valid layouts are NHWC, NCHW, HWC, CHW, and HW.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

This API allows for the rounding mode to be specified. Resamples input images to given size. Result images will be distorted if size is of different aspect ratio. Resize supports the following modes: Nearest Neighbor - values are interpolated using the closest neighbor pixel Bilinear - values are computed using bilinear interpolation of 4 neighboring pixels Destination indices are computed using direct index scaling by default, with no offset added. If the centerResult parameter is true, the destination indices will be scaled and shifted to be centered on the input image. If the alignCorners parameter is true, the corners of the result images will match the input images. Scaling will be modified to a factor of (size - 1) / (inputSize - 1). When alignCorners is true, the centerResult parameter does nothing. In order to achieve the same behavior as OpenCV’s resize and TensorFlowV2’s resize,

To achieve the same behavior as TensorFlowV1 resize

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/resizeNearest(_:sizeTensor:nearestRoundingMode:centerResult:alignCorners:layout:name:)

func (MPSGraph) ResizeNearestWithTensorSizeTensorNearestRoundingModeCenterResultAlignCornersName

func (g MPSGraph) ResizeNearestWithTensorSizeTensorNearestRoundingModeCenterResultAlignCornersName(imagesTensor IMPSGraphTensor, size IMPSGraphTensor, nearestRoundingMode MPSGraphResizeNearestRoundingMode, centerResult bool, alignCorners bool, name string) IMPSGraphTensor

Creates a Resize operation and returns the result tensor.

imagesTensor: Tensor containing input images.

size: The target size of the result tensor. 1D Int32 or Int64 tensor of size equal to rank of input.

nearestRoundingMode: The rounding mode to use when using nearest resampling. Default is roundPreferCeil.

centerResult: Controls if the result image is centered on the input image. When NO, the result will have the top left corner aligned

alignCorners: When YES, the result image will have the same value as the input image in the corners

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Resamples input images to given size using nearest neighbor sampling. Result images will be distorted if size is of different aspect ratio. Destination indices are computed using direct index scaling by default, with no offset added. If the centerResult parameter is true, the destination indices will be scaled and shifted to be centered on the input image. If the alignCorners parameter is true, the corners of the result images will match the input images. Scaling will be modified to a factor of (size - 1) / (inputSize - 1). When alignCorners is true, the centerResult parameter does nothing. In order to achieve the same behavior as OpenCV’s resize and TensorFlowV2’s resize,

To achieve the same behavior as TensorFlowV1 resize

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/resizeNearest(_:sizeTensor:nearestRoundingMode:centerResult:alignCorners:name:)

func (MPSGraph) ResizeNearestWithTensorSizeTensorScaleOffsetTensorNearestRoundingModeLayoutName

func (g MPSGraph) ResizeNearestWithTensorSizeTensorScaleOffsetTensorNearestRoundingModeLayoutName(imagesTensor IMPSGraphTensor, size IMPSGraphTensor, scaleOffset IMPSGraphTensor, nearestRoundingMode MPSGraphResizeNearestRoundingMode, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor

Resamples input images to given size using the provided scale and offset and nearest neighbor sampling See above discussion for more details.

imagesTensor: Tensor containing input images.

size: 1D Int32 or Int64 tensor. A 2-element shape as [newHeight, newWidth]

scaleOffset: 1D float tensor. A 4-element shape as [scaleY, scaleX, offsetY, offsetX]

nearestRoundingMode: The rounding mode to use when using nearest resampling.

layout: Specifies what layout the provided tensor is in. The returned tensor will follow the same layout. Valid layouts are NHWC, NCHW, HWC, CHW, and HW.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/resizeNearest(_:sizeTensor:scaleOffsetTensor:nearestRoundingMode:layout:name:)

func (MPSGraph) ResizeNearestWithTensorSizeTensorScaleTensorOffsetTensorNearestRoundingModeName

func (g MPSGraph) ResizeNearestWithTensorSizeTensorScaleTensorOffsetTensorNearestRoundingModeName(imagesTensor IMPSGraphTensor, size IMPSGraphTensor, scale IMPSGraphTensor, offset IMPSGraphTensor, nearestRoundingMode MPSGraphResizeNearestRoundingMode, name string) IMPSGraphTensor

Creates a Resize operation and returns the result tensor.

imagesTensor: Tensor containing input images.

size: The target size of the result tensor. 1D Int32 or Int64 tensor of size equal to rank of input.

scale: 1D float tensor of size equal to rank of input.

offset: 1D float tensor of size equal to rank of input.

nearestRoundingMode: The rounding mode to use when using nearest resampling. Default is roundPreferCeil.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Resamples input images to given size using the provided scale and offset and nearest neighbor sampling. Destination indices are computed using

For most use cases passing the scale and offset directly is unnecessary, and it is preferable to use the API specifying centerResult and alignCorners.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/resizeNearest(_:sizeTensor:scaleTensor:offsetTensor:nearestRoundingMode:name:)

func (MPSGraph) ResizeTensorSizeModeCenterResultAlignCornersLayoutName

func (g MPSGraph) ResizeTensorSizeModeCenterResultAlignCornersLayoutName(imagesTensor IMPSGraphTensor, size foundation.NSArray, mode MPSGraphResizeMode, centerResult bool, alignCorners bool, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor

Creates a Resize operation and returns the result tensor.

imagesTensor: Tensor containing input images.

size: A 2-element shape as [newHeight, newWidth]

mode: The resampling mode to use. If nearest sampling is specifed, RoundPreferCeil mode will be used.

centerResult: Controls if the result image is centered on the input image. When NO, the result will have the top left corner aligned

alignCorners: When YES, the result image will have the same value as the input image in the corners

layout: Specifies what layout the provided tensor is in. The returned tensor will follow the same layout. Valid layouts are NHWC, NCHW, HWC, CHW, and HW.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Resamples input images to given size. Result images will be distorted if size is of different aspect ratio. Resize supports the following modes: Nearest Neighbor - values are interpolated using the closest neighbor pixel Bilinear - values are computed using bilinear interpolation of 4 neighboring pixels Destination indices are computed using direct index scaling by default, with no offset added. If the centerResult parameter is true, the destination indices will be scaled and shifted to be centered on the input image. If the alignCorners parameter is true, the corners of the result images will match the input images. Scaling will be modified to a factor of (size - 1) / (inputSize - 1). When alignCorners is true, the centerResult parameter does nothing. In order to achieve the same behavior as OpenCV’s resize and TensorFlowV2’s resize,

To achieve the same behavior as TensorFlowV1 resize

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/resize(_:size:mode:centerResult:alignCorners:layout:name:)

func (MPSGraph) ResizeTensorSizeTensorModeCenterResultAlignCornersLayoutName

func (g MPSGraph) ResizeTensorSizeTensorModeCenterResultAlignCornersLayoutName(imagesTensor IMPSGraphTensor, size IMPSGraphTensor, mode MPSGraphResizeMode, centerResult bool, alignCorners bool, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor

Creates a Resize operation and returns the result tensor.

imagesTensor: Tensor containing input images.

size: 1D Int32 or Int64 tensor. A 2-element shape as [newHeight, newWidth]

mode: The resampling mode to use. If nearest sampling is specifed, RoundPreferCeil mode will be used.

centerResult: Controls if the result image is centered on the input image. When NO, the result will have the top left corner aligned

alignCorners: When YES, the result image will have the same value as the input image in the corners

layout: Specifies what layout the provided tensor is in. The returned tensor will follow the same layout. Valid layouts are NHWC, NCHW, HWC, CHW, and HW.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Resamples input images to given size. Result images will be distorted if size is of different aspect ratio. Resize supports the following modes: Nearest Neighbor - values are interpolated using the closest neighbor pixel Bilinear - values are computed using bilinear interpolation of 4 neighboring pixels Destination indices are computed using direct index scaling by default, with no offset added. If the centerResult parameter is true, the destination indices will be scaled and shifted to be centered on the input image. If the alignCorners parameter is true, the corners of the result images will match the input images. Scaling will be modified to a factor of (size - 1) / (inputSize - 1). When alignCorners is true, the centerResult parameter does nothing. In order to achieve the same behavior as OpenCV’s resize and TensorFlowV2’s resize,

To achieve the same behavior as TensorFlowV1 resize

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/resize(_:sizeTensor:mode:centerResult:alignCorners:layout:name:)

func (MPSGraph) ResizeTensorSizeTensorModeCenterResultAlignCornersName

func (g MPSGraph) ResizeTensorSizeTensorModeCenterResultAlignCornersName(imagesTensor IMPSGraphTensor, size IMPSGraphTensor, mode MPSGraphResizeMode, centerResult bool, alignCorners bool, name string) IMPSGraphTensor

Creates a Resize operation and returns the result tensor.

imagesTensor: Tensor containing input images.

size: The target size of the result tensor. 1D Int32 or Int64 tensor of size equal to rank of input.

mode: The resampling mode to use. If nearest sampling is specifed, RoundPreferCeil mode will be used.

centerResult: Controls if the result image is centered on the input image. When NO, the result will have the top left corner aligned

alignCorners: When YES, the result image will have the same value as the input image in the corners

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Resamples input images to given size. Result images will be distorted if size is of different aspect ratio. Resize supports the following modes: Nearest Neighbor - values are interpolated using the closest neighbor pixel Bilinear - values are computed using bilinear interpolation of 4 neighboring pixels Destination indices are computed using direct index scaling by default, with no offset added. If the centerResult parameter is true, the destination indices will be scaled and shifted to be centered on the input image. If the alignCorners parameter is true, the corners of the result images will match the input images. Scaling will be modified to a factor of (size - 1) / (inputSize - 1). When alignCorners is true, the centerResult parameter does nothing. In order to achieve the same behavior as OpenCV’s resize and TensorFlowV2’s resize,

To achieve the same behavior as TensorFlowV1 resize

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/resize(_:sizeTensor:mode:centerResult:alignCorners:name:)

func (MPSGraph) ResizeTensorSizeTensorScaleOffsetTensorModeLayoutName

func (g MPSGraph) ResizeTensorSizeTensorScaleOffsetTensorModeLayoutName(imagesTensor IMPSGraphTensor, size IMPSGraphTensor, scaleOffset IMPSGraphTensor, mode MPSGraphResizeMode, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor

Resamples input images to given size using the provided scale and offset. Destination indices are computed using

imagesTensor: Tensor containing input images.

size: 1D Int32 or Int64 tensor. A 2-element shape as [newHeight, newWidth]

scaleOffset: 1D float tensor. A 4-element shape as [scaleY, scaleX, offsetY, offsetX]

mode: The resampling mode to use. If nearest sampling is specifed, RoundPreferCeil mode will be used.

layout: Specifies what layout the provided tensor is in. The returned tensor will follow the same layout. Valid layouts are NHWC, NCHW, HWC, CHW, and HW.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

For most use cases passing the scale and offset directly is unnecessary, and it is preferable to use the API specifying centerResult and alignCorners.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/resize(_:sizeTensor:scaleOffsetTensor:mode:layout:name:)

func (MPSGraph) ResizeTensorSizeTensorScaleTensorOffsetTensorModeName

func (g MPSGraph) ResizeTensorSizeTensorScaleTensorOffsetTensorModeName(imagesTensor IMPSGraphTensor, size IMPSGraphTensor, scale IMPSGraphTensor, offset IMPSGraphTensor, mode MPSGraphResizeMode, name string) IMPSGraphTensor

Creates a Resize operation and returns the result tensor.

imagesTensor: Tensor containing input images.

size: The target size of the result tensor. 1D Int32 or Int64 tensor of size equal to rank of input.

scale: 1D float tensor of size equal to rank of input.

offset: 1D float tensor of size equal to rank of input.

mode: The resampling mode to use. If nearest sampling is specifed, RoundPreferCeil mode will be used.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Resamples input images to given size using the provided scale and offset. Destination indices are computed using

For most use cases passing the scale and offset directly is unnecessary, and it is preferable to use the API specifying centerResult and alignCorners.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/resize(_:sizeTensor:scaleTensor:offsetTenor:mode:name:)

func (MPSGraph) ResizeWithGradientTensorInputModeCenterResultAlignCornersLayoutName

func (g MPSGraph) ResizeWithGradientTensorInputModeCenterResultAlignCornersLayoutName(gradient IMPSGraphTensor, input IMPSGraphTensor, mode MPSGraphResizeMode, centerResult bool, alignCorners bool, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor

Creates a Resize gradient operation and returns the result tensor.

gradient: Incoming gradient tensor

input: Forward pass input tensor

mode: The resampling mode to use. If nearest sampling is specifed, RoundPreferCeil mode will be used.

centerResult: Controls if the result image is centered on the input image. When NO, the result will have the top left corner aligned

alignCorners: When YES, the result image will have the same value as the input image in the corners

layout: Specifies what layout the provided tensor is in. The returned tensor will follow the same layout. Valid layouts are NHWC, NCHW, HWC, CHW, and HW.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Computes the gradient for the forward pass Resize op with identical parameters. See discussion of resizeTensor for more in depth description of resize paramters.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/resize(withGradientTensor:input:mode:centerResult:alignCorners:layout:name:)

func (MPSGraph) ResizeWithGradientTensorInputScaleOffsetTensorModeLayoutName

func (g MPSGraph) ResizeWithGradientTensorInputScaleOffsetTensorModeLayoutName(gradient IMPSGraphTensor, input IMPSGraphTensor, scaleOffset IMPSGraphTensor, mode MPSGraphResizeMode, layout MPSGraphTensorNamedDataLayout, name string) IMPSGraphTensor

Creates a Resize gradient operation and returns the result tensor.

gradient: Incoming gradient tensor

input: Forward pass input tensor

scaleOffset: 1D float tensor. A 4-element shape as [scaleY, scaleX, offsetY, offsetX]

mode: The resampling mode to use. If nearest sampling is specifed, RoundPreferCeil mode will be used.

layout: Specifies what layout the provided tensor is in. The returned tensor will follow the same layout. Valid layouts are NHWC, NCHW, HWC, CHW, and HW.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Computes the gradient for the forward pass Resize op with identical parameters. See discussion of resizeTensor for more in depth description of resize paramters.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/resize(withGradientTensor:input:scaleOffsetTensor:mode:layout:name:)

func (MPSGraph) ResizeWithGradientTensorInputScaleTensorOffsetTensorModeName

func (g MPSGraph) ResizeWithGradientTensorInputScaleTensorOffsetTensorModeName(gradient IMPSGraphTensor, input IMPSGraphTensor, scale IMPSGraphTensor, offset IMPSGraphTensor, mode MPSGraphResizeMode, name string) IMPSGraphTensor

Creates a Resize gradient operation and returns the result tensor.

gradient: Incoming gradient tensor

input: Forward pass input tensor

scale: 1D float tensor of size equal to rank of input.

offset: 1D float tensor of size equal to rank of input.

mode: The resampling mode to use. If nearest sampling is specifed, RoundPreferCeil mode will be used.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Computes the gradient for the forward pass Resize op with identical parameters. See discussion of resizeTensor for more in depth description of resize paramters.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/resize(withGradientTensor:input:scale:offsetTensor:mode:name:)

func (MPSGraph) ReverseTensorAxesName

func (g MPSGraph) ReverseTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor

Creates a reverse operation and returns the result tensor.

tensor: The tensor to be reversed.

axes: A tensor that specifies axes to be reversed (Axes must be unique and within normal axis range).

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Reverses a tensor on given axes. Semantics based on TensorFlow reverse op.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reverse(_:axes:name:)

func (MPSGraph) ReverseTensorAxesTensorName

func (g MPSGraph) ReverseTensorAxesTensorName(tensor IMPSGraphTensor, axesTensor IMPSGraphTensor, name string) IMPSGraphTensor

Creates a reverse operation and returns the result tensor.

tensor: The tensor to be reversed.

axesTensor: A tensor that specifies axes to be reversed (Axes must be unique and within normal axis range).

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Reverses a tensor on given axes. Semantics based on TensorFlow reverse op.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reverse(_:axesTensor:name:)

func (MPSGraph) ReverseTensorName

func (g MPSGraph) ReverseTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Creates a reverse operation and returns the result tensor.

tensor: The tensor to be reversed.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Reverses a tensor on all axes. Semantics based on TensorFlow reverse op.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/reverse(_:name:)

func (MPSGraph) RintWithTensorName

func (g MPSGraph) RintWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Rounds the input tensor elements by rounding to nearest even.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/rint(with:name:)

func (MPSGraph) RoundWithTensorName

func (g MPSGraph) RoundWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Rounds the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/round(with:name:)

func (MPSGraph) RunAsyncWithFeedsTargetTensorsTargetOperationsExecutionDescriptor

func (g MPSGraph) RunAsyncWithFeedsTargetTensorsTargetOperationsExecutionDescriptor(feeds MPSGraphTensorDataDictionary, targetTensors []MPSGraphTensor, targetOperations []MPSGraphOperation, executionDescriptor IMPSGraphExecutionDescriptor) MPSGraphTensorDataDictionary

Runs the graph for the given feeds and returns the target tensor values, ensuring all target operations also executed.

feeds: Feeds dictionary for the placeholder tensors.

targetTensors: Tensors for which the caller wishes MPSGraphTensorData to be returned.

targetOperations: Operations to be completed at the end of the run.

executionDescriptor: ExecutionDescriptor to be passed in and used.

Return Value

A valid MPSGraphTensor : MPSGraphTensorData dictionary with results synchronized to the CPU memory.

Discussion

This call is asynchronous and will return immediately if a completionHandler is set.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/runAsync(feeds:targetTensors:targetOperations:executionDescriptor:)

func (MPSGraph) RunAsyncWithMTLCommandQueueFeedsTargetOperationsResultsDictionaryExecutionDescriptor

func (g MPSGraph) RunAsyncWithMTLCommandQueueFeedsTargetOperationsResultsDictionaryExecutionDescriptor(commandQueue metal.MTLCommandQueue, feeds MPSGraphTensorDataDictionary, targetOperations []MPSGraphOperation, resultsDictionary MPSGraphTensorDataDictionary, executionDescriptor IMPSGraphExecutionDescriptor)

Encodes the graph for the given feeds to returns the target tensor values in the results dictionary provided by the user.

commandQueue: CommandQueue passed to exectute the graph on.

feeds: Feeds dictionary for the placeholder tensors.

targetOperations: Operations to be completed at the end of the run.

resultsDictionary: MPSGraphTensors dictionary passed by user, these will be filled with graph output data.

executionDescriptor: ExecutionDescriptor to be passed in and used.

Discussion

It ensures all target operations also executed. This call is asynchronous and will return immediately if a completionHandler is set.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/runAsync(with:feeds:targetOperations:resultsDictionary:executionDescriptor:)

func (MPSGraph) RunAsyncWithMTLCommandQueueFeedsTargetTensorsTargetOperationsExecutionDescriptor

func (g MPSGraph) RunAsyncWithMTLCommandQueueFeedsTargetTensorsTargetOperationsExecutionDescriptor(commandQueue metal.MTLCommandQueue, feeds MPSGraphTensorDataDictionary, targetTensors []MPSGraphTensor, targetOperations []MPSGraphOperation, executionDescriptor IMPSGraphExecutionDescriptor) MPSGraphTensorDataDictionary

Runs the graph for the given feeds and returns the target tensor values, ensuring all target operations also executed.

commandQueue: CommandQueue passed to exectute the graph on.

feeds: Feeds dictionary for the placeholder tensors.

targetTensors: Tensors for which the caller wishes MPSGraphTensorData to be returned.

targetOperations: Operations to be completed at the end of the run.

executionDescriptor: ExecutionDescriptor to be passed in and used.

Return Value

A valid MPSGraphTensor : MPSGraphTensorData dictionary with results synchronized to the CPU memory if MPSGraphOptionsSynchronizeResults set.

Discussion

This call is asynchronous and will return immediately if a completionHandler is set.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/runAsync(with:feeds:targetTensors:targetOperations:executionDescriptor:)

func (MPSGraph) RunWithFeedsTargetTensorsTargetOperations

func (g MPSGraph) RunWithFeedsTargetTensorsTargetOperations(feeds MPSGraphTensorDataDictionary, targetTensors []MPSGraphTensor, targetOperations []MPSGraphOperation) MPSGraphTensorDataDictionary

Runs the graph for the given feeds and returns the target tensor values, ensuring all target operations also executed.

feeds: Feeds dictionary for the placeholder tensors.

targetTensors: Tensors for which the caller wishes MPSGraphTensorData to be returned.

targetOperations: Operations to be completed at the end of the run.

Return Value

A valid MPSGraphTensor : MPSGraphTensorData dictionary with results synchronized to the CPU memory.

Discussion

This call blocks until execution has completed.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/run(feeds:targetTensors:targetOperations:)

func (MPSGraph) RunWithMTLCommandQueueFeedsTargetOperationsResultsDictionary

func (g MPSGraph) RunWithMTLCommandQueueFeedsTargetOperationsResultsDictionary(commandQueue metal.MTLCommandQueue, feeds MPSGraphTensorDataDictionary, targetOperations []MPSGraphOperation, resultsDictionary MPSGraphTensorDataDictionary)

Runs the graph for the given feeds and returns the target tensor values in the results dictionary provided by the user.

commandQueue: CommandQueue passed to exectute the graph on.

feeds: Feeds dictionary for the placeholder tensors.

targetOperations: Operations to be completed at the end of the run.

resultsDictionary: MPSGraphTensors dictionary passed by user, these will be filled with graph output data.

Discussion

It also ensures all target operations also executed. This call blocks until execution has completed.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/run(with:feeds:targetOperations:resultsDictionary:)

func (MPSGraph) RunWithMTLCommandQueueFeedsTargetTensorsTargetOperations

func (g MPSGraph) RunWithMTLCommandQueueFeedsTargetTensorsTargetOperations(commandQueue metal.MTLCommandQueue, feeds MPSGraphTensorDataDictionary, targetTensors []MPSGraphTensor, targetOperations []MPSGraphOperation) MPSGraphTensorDataDictionary

Runs the graph for the given feeds and returns the target tensor values, ensuring all target operations also executed.

commandQueue: CommandQueue passed to exectute the graph on.

feeds: Feeds dictionary for the placeholder tensors.

targetTensors: Tensors for which the caller wishes MPSGraphTensorData to be returned.

targetOperations: Operations to be completed at the end of the run.

Return Value

A valid MPSGraphTensor : MPSGraphTensorData dictionary with results synchronized to the CPU memory.

Discussion

This call blocks until execution has completed.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/run(with:feeds:targetTensors:targetOperations:)

func (MPSGraph) SampleGridWithSourceTensorCoordinateTensorLayoutNormalizeCoordinatesRelativeCoordinatesAlignCornersPaddingModeNearestRoundingModeConstantValueName

func (g MPSGraph) SampleGridWithSourceTensorCoordinateTensorLayoutNormalizeCoordinatesRelativeCoordinatesAlignCornersPaddingModeNearestRoundingModeConstantValueName(source IMPSGraphTensor, coordinates IMPSGraphTensor, layout MPSGraphTensorNamedDataLayout, normalizeCoordinates bool, relativeCoordinates bool, alignCorners bool, paddingMode MPSGraphPaddingMode, nearestRoundingMode MPSGraphResizeNearestRoundingMode, constantValue float64, name string) IMPSGraphTensor

Samples a tensor using the coordinates provided, using nearest neighbor sampling with specified rounding mode.

source: Tensor containing source data

coordinates: A tensor (N, Hout, Wout, 2) that contains the coordinates of the samples in the source tensor that constitute the output tensor.

layout: Specifies what layout the provided tensor is in. The returned tensor will follow the same layout. Valid layouts are NHWC and NCHW.

normalizeCoordinates: If true, coordinates are within [-1, 1] x [-1, 1] otherwise they are in pixels in the input tensor.

relativeCoordinates: If true, coordinates are relative to the postion of the pixel in the output tensor and scaled back to the input tensor size

alignCorners: If true, coordinate extrema are equal to the center of edge pixels, otherwise extrema are equal to outer edge of edge pixels

paddingMode: Determines how samples outside the inputTensor are evaluated (only constant, reflect, symmetric and clampToEdge are supported)

nearestRoundingMode: The rounding mode to use for determining the nearest neighbor. Valid modes are roundPreferCeil, roundPreferFloor, ceil, and floor.

constantValue: If paddingMode is MPSGraphPaddingModeConstant, then this constant is used for samples outside the input tensor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Given an input tensor (N, H1, W1, C) or (N, C, H1, W1) and coordinates tensor (N, H2, W2, 2) this operation outputs a tensor of size (N, H2, W2, C) or (N, C, H2, W2) by sampling the input tensor at the coordinates provided by the coordinates tensor.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sampleGrid(withSourceTensor:coordinateTensor:layout:normalizeCoordinates:relativeCoordinates:alignCorners:paddingMode:nearestRoundingMode:constantValue:name:)

func (MPSGraph) SampleGridWithSourceTensorCoordinateTensorLayoutNormalizeCoordinatesRelativeCoordinatesAlignCornersPaddingModeSamplingModeConstantValueName

func (g MPSGraph) SampleGridWithSourceTensorCoordinateTensorLayoutNormalizeCoordinatesRelativeCoordinatesAlignCornersPaddingModeSamplingModeConstantValueName(source IMPSGraphTensor, coordinates IMPSGraphTensor, layout MPSGraphTensorNamedDataLayout, normalizeCoordinates bool, relativeCoordinates bool, alignCorners bool, paddingMode MPSGraphPaddingMode, samplingMode MPSGraphResizeMode, constantValue float64, name string) IMPSGraphTensor

Samples a tensor using the coordinates provided.

source: Tensor containing source data

coordinates: A tensor (N, Hout, Wout, 2) that contains the coordinates of the samples in the source tensor that constitute the output tensor.

layout: Specifies what layout the provided tensor is in. The returned tensor will follow the same layout. Valid layouts are NHWC and NCHW.

normalizeCoordinates: If true, coordinates are within [-1, 1] x [-1, 1] otherwise they are in pixels in the input tensor.

relativeCoordinates: If true, coordinates are relative to the postion of the pixel in the output tensor and scaled back to the input tensor size

alignCorners: If true, coordinate extrema are equal to the center of edge pixels, otherwise extrema are equal to outer edge of edge pixels

paddingMode: Determines how samples outside the inputTensor are evaluated (only constant, reflect, symmetric and clampToEdge are supported)

samplingMode: Can be either MPSGraphResizeNearest or MPSGraphResizeBilinear. Nearest sampling will use roundPreferCeil.

constantValue: If paddingMode is MPSGraphPaddingModeConstant, then this constant is used for samples outside the input tensor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Given an input tensor (N, H1, W1, C) or (N, C, H1, W1) and coordinates tensor (N, H2, W2, 2) this operation outputs a tensor of size (N, H2, W2, C) or (N, C, H2, W2) by sampling the input tensor at the coordinates provided by the coordinates tensor.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sampleGrid(withSourceTensor:coordinateTensor:layout:normalizeCoordinates:relativeCoordinates:alignCorners:paddingMode:samplingMode:constantValue:name:)

func (MPSGraph) ScaledDotProductAttentionWithQueryTensorKeyTensorValueTensorDescriptorName

func (g MPSGraph) ScaledDotProductAttentionWithQueryTensorKeyTensorValueTensorDescriptorName(queryTensor IMPSGraphTensor, keyTensor IMPSGraphTensor, valueTensor IMPSGraphTensor, descriptor IMPSGraphSDPADescriptor, name string) IMPSGraphTensor

Creates a scaled dot product attention (SDPA) operation using a descriptor and returns the result tensor.

queryTensor: A tensor that represents the query projection.

keyTensor: A tensor that represents the key projection.

valueTensor: A tensor that represents the value projection.

descriptor: A descriptor specifying scale and optional features (mask, isCausal, sinks).

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

The descriptor allows configuring an optional attention mask, causal masking, and attention sinks without requiring a separate API method for each combination of features.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/scaledDotProductAttention(query:key:value:descriptor:name:)

func (MPSGraph) ScaledDotProductAttentionWithQueryTensorKeyTensorValueTensorMaskTensorScaleName

func (g MPSGraph) ScaledDotProductAttentionWithQueryTensorKeyTensorValueTensorMaskTensorScaleName(queryTensor IMPSGraphTensor, keyTensor IMPSGraphTensor, valueTensor IMPSGraphTensor, maskTensor IMPSGraphTensor, scale float32, name string) IMPSGraphTensor

Creates a scaled dot product attention (SDPA) operation and returns the result tensor.

queryTensor: A tensor that represents the query projection.

keyTensor: A tensor that represents the key projection.

valueTensor: A tensor that represents the value projection.

maskTensor: An optional tensor that contains a mask that is applied to the scaled, matrix multiplied query and value matrices. If mask tensor is nil, the QK^T is not element-wise masked.

scale: A scale that is applied to the result of query and value matrix multiply.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

SDPA Op computes attention by computing softmax(scale * QK^T + M)V. queryTensor Q with shape [B, Hq, Nq, F] and keyTensor K with shape [B, Hq, Nkv, F], with Q’s H dimension expandable to satisfy matmul QK^T. maskTensor M’s shape should be broadcast compatible to satisfy (QK^T + M). valueTensor V with shape [B, Hv, Nkv, F] should satisfy the matmul (QK^T + M)V.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/scaledDotProductAttention(query:key:value:mask:scale:name:)

func (MPSGraph) ScaledDotProductAttentionWithQueryTensorKeyTensorValueTensorScaleName

func (g MPSGraph) ScaledDotProductAttentionWithQueryTensorKeyTensorValueTensorScaleName(queryTensor IMPSGraphTensor, keyTensor IMPSGraphTensor, valueTensor IMPSGraphTensor, scale float32, name string) IMPSGraphTensor

Creates a scaled dot product attention (SDPA) operation (without a mask) and returns the result tensor.

queryTensor: A tensor that represents the query projection.

keyTensor: A tensor that represents the key projection.

valueTensor: A tensor that represents the value projection.

scale: A scale that is applied on the result of query and value matrix multiply.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/scaledDotProductAttention(query:key:value:scale:name:)

func (MPSGraph) ScatterAlongAxisTensorWithDataTensorUpdatesTensorIndicesTensorModeName

func (g MPSGraph) ScatterAlongAxisTensorWithDataTensorUpdatesTensorIndicesTensorModeName(axisTensor IMPSGraphTensor, dataTensor IMPSGraphTensor, updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, mode MPSGraphScatterMode, name string) IMPSGraphTensor

Creates a ScatterAlongAxis operation and returns the result tensor.

axisTensor: Scalar Int32 tensor. The axis to scatter to. Negative values wrap around

dataTensor: The input tensor to scatter values onto

updatesTensor: The input tensor to scatter values from

indicesTensor: Int32 or Int64 tensor used to index the result tensor.

mode: The type of update to use

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Scatter values from `updatesTensor` along the specified `axis` at indices in `indicesTensor` onto `dataTensor`. Values in `dataTensor` are updated following `mode`. See MPSGraphScatterMode. The shape of `updatesTensor` and `indicesTensor` must match. The shape of `dataTensor` must match except at `axis`. If an index is out of bounds of `shape` along `axis` the update value is skipped. For example,

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/scatterAlongAxisTensor(_:data:updates:indices:mode:name:)

func (MPSGraph) ScatterAlongAxisTensorWithUpdatesTensorIndicesTensorShapeModeName

func (g MPSGraph) ScatterAlongAxisTensorWithUpdatesTensorIndicesTensorShapeModeName(axisTensor IMPSGraphTensor, updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, shape foundation.NSArray, mode MPSGraphScatterMode, name string) IMPSGraphTensor

Creates a ScatterAlongAxis operation and returns the result tensor.

axisTensor: Scalar Int32 tensor. The axis to scatter to. Negative values wrap around

updatesTensor: The input tensor to scatter values from

indicesTensor: Int32 or Int64 tensor used to index the result tensor.

mode: The type of update to use

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Scatter values from `updatesTensor` along the specified `axis` at indices in `indicesTensor` into a result tensor. Values are updated following `mode`. See MPSGraphScatterMode. The shape of `updatesTensor` and `indicesTensor` must match. `shape` must match except at `axis`. The shape of the result tensor is equal to `shape` and initialized with an initial value corresponding to `mode`. If an index is out of bounds of `shape` along `axis` the update value is skipped.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/scatterAlongAxisTensor(_:updates:indices:shape:mode:name:)

func (MPSGraph) ScatterAlongAxisWithDataTensorUpdatesTensorIndicesTensorModeName

func (g MPSGraph) ScatterAlongAxisWithDataTensorUpdatesTensorIndicesTensorModeName(axis int, dataTensor IMPSGraphTensor, updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, mode MPSGraphScatterMode, name string) IMPSGraphTensor

Creates a ScatterAlongAxis operation and returns the result tensor.

axis: The axis to scatter to. Negative values wrap around

dataTensor: The input tensor to scatter values onto

updatesTensor: The input tensor to scatter values from

indicesTensor: Int32 or Int64 tensor used to index the result tensor.

mode: The type of update to use

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Scatter values from `updatesTensor` along the specified `axis` at indices in `indicesTensor` onto `dataTensor`. Values in `dataTensor` are updated following `mode`. See MPSGraphScatterMode. The shape of `updatesTensor` and `indicesTensor` must match. The shape of `dataTensor` must match except at `axis`. If an index is out of bounds of `shape` along `axis` the update value is skipped. For example,

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/scatterAlongAxis(_:data:updates:indices:mode:name:)

func (MPSGraph) ScatterAlongAxisWithUpdatesTensorIndicesTensorShapeModeName

func (g MPSGraph) ScatterAlongAxisWithUpdatesTensorIndicesTensorShapeModeName(axis int, updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, shape foundation.NSArray, mode MPSGraphScatterMode, name string) IMPSGraphTensor

Creates a ScatterAlongAxis operation and returns the result tensor.

axis: The axis to scatter to. Negative values wrap around

updatesTensor: The input tensor to scatter values from

indicesTensor: Int32 or Int64 tensor used to index the result tensor.

mode: The type of update to use

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Scatter values from `updatesTensor` along the specified `axis` at indices in `indicesTensor` into a result tensor. Values are updated following `mode`. See MPSGraphScatterMode. The shape of `updatesTensor` and `indicesTensor` must match. `shape` must match except at `axis`. The shape of the result tensor is equal to `shape` and initialized with an initial value corresponding to `mode`. If an index is out of bounds of `shape` along `axis` the update value is skipped.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/scatterAlongAxis(_:updates:indices:shape:mode:name:)

func (MPSGraph) ScatterNDWithDataTensorUpdatesTensorIndicesTensorBatchDimensionsModeName

func (g MPSGraph) ScatterNDWithDataTensorUpdatesTensorIndicesTensorBatchDimensionsModeName(dataTensor IMPSGraphTensor, updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, batchDimensions uint, mode MPSGraphScatterMode, name string) IMPSGraphTensor

Creates a ScatterND operation and returns the result tensor.

dataTensor: Tensor containing inital values of same shape as result tensor

updatesTensor: Tensor containing slices to be inserted into the result tensor.

indicesTensor: Tensor containg the result indices to insert slices at

batchDimensions: The number of batch dimensions

mode: The type of update to use on the destination

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Scatters the slices in updatesTensor to the result tensor along the indices in indicesTensor, on top of dataTensor. The scatter is defined as

Collisions will be updated according to mode, and slices not set by indices are set to 0. The tensors have the following shape requirements

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/scatterNDWithData(_:updates:indices:batchDimensions:mode:name:)

func (MPSGraph) ScatterNDWithUpdatesTensorIndicesTensorShapeBatchDimensionsModeName

func (g MPSGraph) ScatterNDWithUpdatesTensorIndicesTensorShapeBatchDimensionsModeName(updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, shape foundation.NSArray, batchDimensions uint, mode MPSGraphScatterMode, name string) IMPSGraphTensor

Creates a ScatterND operation and returns the result tensor.

updatesTensor: Tensor containing slices to be inserted into the result tensor.

indicesTensor: Tensor containg the result indices to insert slices at

shape: The shape of the result tensor.

batchDimensions: The number of batch dimensions

mode: The type of update to use on the destination

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Scatters the slices in updatesTensor to the result tensor along the indices in indicesTensor. The scatter is defined as

Collisions will be summed, and slices not set by indices are set to 0. The tensors have the following shape requirements

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/scatterND(withUpdatesTensor:indicesTensor:shape:batchDimensions:mode:name:)

func (MPSGraph) ScatterNDWithUpdatesTensorIndicesTensorShapeBatchDimensionsName

func (g MPSGraph) ScatterNDWithUpdatesTensorIndicesTensorShapeBatchDimensionsName(updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, shape foundation.NSArray, batchDimensions uint, name string) IMPSGraphTensor

Creates a ScatterND operation and returns the result tensor.

updatesTensor: Tensor containing slices to be inserted into the result tensor.

indicesTensor: Tensor containg the result indices to insert slices at

shape: The shape of the result tensor.

batchDimensions: The number of batch dimensions

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Scatters the slices in updatesTensor to the result tensor along the indices in indicesTensor. The scatter is defined as

Collisions will be summed, and slices not set by indices are set to 0. The tensors have the following shape requirements

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/scatterND(withUpdatesTensor:indicesTensor:shape:batchDimensions:name:)

func (MPSGraph) ScatterWithDataTensorUpdatesTensorIndicesTensorAxisModeName

func (g MPSGraph) ScatterWithDataTensorUpdatesTensorIndicesTensorAxisModeName(dataTensor IMPSGraphTensor, updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, axis int, mode MPSGraphScatterMode, name string) IMPSGraphTensor

Creates a Scatter operation and returns the result tensor.

dataTensor: Tensor containing inital values of same shape as result tensor

updatesTensor: Tensor containing values to be inserted into the result tensor.

indicesTensor: Tensor containg the result indices to insert values at

axis: The axis of the result tensor to scatter values along

mode: The type of update to use on the destination

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Scatters the slices in updatesTensor to the result tensor along the indices in indicesTensor, on top of dataTensor. The scatter is defined as

Collisions will be updated according to mode. The tensors have the following shape requirements

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/scatterWithData(_:updates:indices:axis:mode:name:)

func (MPSGraph) ScatterWithUpdatesTensorIndicesTensorShapeAxisModeName

func (g MPSGraph) ScatterWithUpdatesTensorIndicesTensorShapeAxisModeName(updatesTensor IMPSGraphTensor, indicesTensor IMPSGraphTensor, shape foundation.NSArray, axis int, mode MPSGraphScatterMode, name string) IMPSGraphTensor

Creates a Scatter operation and returns the result tensor.

updatesTensor: Tensor containing values to be inserted into the result tensor.

indicesTensor: Tensor containg the result indices to insert values at.

shape: The shape of the result tensor.

axis: The axis of the result tensor to scatter values along.

mode: The type of update to use on the destination.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Scatters the slices in updatesTensor to the result tensor along the indices in indicesTensor. The scatter is defined as

Collisions will be updated according to mode. The tensors have the following shape requirements

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/scatter(_:indices:shape:axis:mode:name:)

func (MPSGraph) SelectWithPredicateTensorTruePredicateTensorFalsePredicateTensorName

func (g MPSGraph) SelectWithPredicateTensorTruePredicateTensorFalsePredicateTensorName(predicateTensor IMPSGraphTensor, truePredicateTensor IMPSGraphTensor, falseSelectTensor IMPSGraphTensor, name string) IMPSGraphTensor

Selects values from either the true or false predicate tensor, depending on the values in the first input.

predicateTensor: The predicate tensor.

truePredicateTensor: The tensor to select values from if predicate is true.

falseSelectTensor: The tensor to select values from if predicate is false.

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 select operation and returns the result tensor. It supports broadcasting as well.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/select(predicate:trueTensor:falseTensor:name:)

func (MPSGraph) SetOptions

func (g MPSGraph) SetOptions(value MPSGraphOptions)

func (MPSGraph) ShapeOfTensorName

func (g MPSGraph) ShapeOfTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Creates a shape-of operation and returns the result tensor.

tensor: The input tensor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Returns a rank-1 tensor of type [MPSDataTypeInt32] with the values of the static shape of the input tensor.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/shapeOf(_:name:)

func (MPSGraph) SigmoidGradientWithIncomingGradientSourceTensorName

func (g MPSGraph) SigmoidGradientWithIncomingGradientSourceTensorName(gradient IMPSGraphTensor, source IMPSGraphTensor, name string) IMPSGraphTensor

Computes the gradient of the sigmoid function using the incoming gradient tensor.

gradient: The incoming gradient tensor.

source: The input tensor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sigmoidGradient(withIncomingGradient:sourceTensor:name:)

func (MPSGraph) SigmoidWithTensorName

func (g MPSGraph) SigmoidWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Computes the sigmoid operation on an input tensor.

tensor: The input tensor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sigmoid(with:name:)

func (MPSGraph) SignWithTensorName

func (g MPSGraph) SignWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the sign of the input tensor elements.

tensor: The input tensor.

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 returns 1.0 if the correspnding input element is greater than 0, -1.0 if it is lesser than 0, -0.0 if it is equal to -0.0, and +0.0 if it is equal to +0.0.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sign(with:name:)

func (MPSGraph) SignbitWithTensorName

func (g MPSGraph) SignbitWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Returns the sign bit of the input tensor elements.

tensor: The input tensor.

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 returns `true` if the sign bit is set for the correspnding floating-point input element, otherwise it returns `false`.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/signbit(with:name:)

func (MPSGraph) SinWithTensorName

func (g MPSGraph) SinWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies the sine operation to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sin(with:name:)

func (MPSGraph) SingleGateRNNGradientsWithSourceTensorRecurrentWeightSourceGradientZStateInitStateDescriptorName

func (g MPSGraph) SingleGateRNNGradientsWithSourceTensorRecurrentWeightSourceGradientZStateInitStateDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, sourceGradient IMPSGraphTensor, zState IMPSGraphTensor, initState IMPSGraphTensor, descriptor IMPSGraphSingleGateRNNDescriptor, name string) []MPSGraphTensor

Creates a single-gate RNN gradient operation and returns the gradient tensor values.

source: A tensor that contains the source data `x[t]` with the data layout [T,N,I]. In case `inputWeight = nil` and `bidirectional = NO` then the layout is [T,N,H] and for `inputWeight = nil` and `bidirectional = YES` the layout is [T,N,2H].

recurrentWeight: A tensor containing the recurrent weights [R]. For `bidirectional` the layout is [2,H,H] and otherwise it is [H,H]. Note: For `bidirectional` this tensor must have a static shape.

sourceGradient: The input gradient, that is the gradient of a tensor with respect to the first output of the forward pass.

zState: The second output of MPSGraph.SingleGateRNNWithSourceTensorRecurrentWeightInputWeightBiasInitStateMaskDescriptorName with `descriptor.Training() = YES`.

initState: The initial internal state of the RNN `h[-1]` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].

descriptor: A descriptor that defines the parameters for the RNN operation.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array containing gradients for each input tensor, except for `sourceGradient` and `mask`. In case an input is `nil`, no gradient will be returned for it. The order of the gradients will be: for `source`, for `recurrentWeight`, for `inputWeight`, for `bias` and finally for `initState`.

Discussion

For details of this operation and parameters, refer to documentation of MPSGraph.SingleGateRNNWithSourceTensorRecurrentWeightInputWeightBiasInitStateMaskDescriptorName.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/singleGateRNNGradients(_:recurrentWeight:sourceGradient:zState:initState:descriptor:name:)

func (MPSGraph) SingleGateRNNGradientsWithSourceTensorRecurrentWeightSourceGradientZStateInputWeightBiasInitStateDescriptorName

func (g MPSGraph) SingleGateRNNGradientsWithSourceTensorRecurrentWeightSourceGradientZStateInputWeightBiasInitStateDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, sourceGradient IMPSGraphTensor, zState IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, descriptor IMPSGraphSingleGateRNNDescriptor, name string) []MPSGraphTensor

Creates a single-gate RNN gradient operation and returns the gradient tensor values.

source: A tensor that contains the source data `x[t]` with the data layout [T,N,I]. In case `inputWeight = nil` and `bidirectional = NO` then the layout is [T,N,H] and for `inputWeight = nil` and `bidirectional = YES` the layout is [T,N,2H].

recurrentWeight: A tensor containing the recurrent weights [R]. For `bidirectional` the layout is [2,H,H] and otherwise it is [H,H]. Note: For `bidirectional` this tensor must have a static shape.

sourceGradient: The input gradient, that is the gradient of a tensor with respect to the first output of the forward pass.

zState: The second output of MPSGraph.SingleGateRNNWithSourceTensorRecurrentWeightInputWeightBiasInitStateMaskDescriptorName with `descriptor.Training() = YES`.

inputWeight: A tensor containing the input weights matrix [W] - optional, if missing the operation assumes a diagonal unit-matrix. For `bidirectional` the layout is [2H,I] and otherwise it is [H,I].

bias: A tensor containing the bias `b` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [2H] and otherwise it is [H].

initState: The initial internal state of the RNN `h[-1]` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].

descriptor: A descriptor that defines the parameters for the RNN operation.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array containing gradients for each input tensor, except for `sourceGradient` and `mask`. In case an input is `nil`, no gradient will be returned for it. The order of the gradients will be: for `source`, for `recurrentWeight`, for `inputWeight`, for `bias` and finally for `initState`.

Discussion

For details of this operation and parameters, refer to documentation of MPSGraph.SingleGateRNNWithSourceTensorRecurrentWeightInputWeightBiasInitStateMaskDescriptorName.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/singleGateRNNGradients(_:recurrentWeight:sourceGradient:zState:inputWeight:bias:initState:descriptor:name:)

func (MPSGraph) SingleGateRNNGradientsWithSourceTensorRecurrentWeightSourceGradientZStateInputWeightBiasInitStateMaskDescriptorName

func (g MPSGraph) SingleGateRNNGradientsWithSourceTensorRecurrentWeightSourceGradientZStateInputWeightBiasInitStateMaskDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, sourceGradient IMPSGraphTensor, zState IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, mask IMPSGraphTensor, descriptor IMPSGraphSingleGateRNNDescriptor, name string) []MPSGraphTensor

Creates a single-gate RNN gradient operation and returns the gradient tensor values.

source: A tensor that contains the source data `x[t]` with the data layout [T,N,I]. In case `inputWeight = nil` and `bidirectional = NO` then the layout is [T,N,H] and for `inputWeight = nil` and `bidirectional = YES` the layout is [T,N,2H].

recurrentWeight: A tensor containing the recurrent weights [R]. For `bidirectional` the layout is [2,H,H] and otherwise it is [H,H]. Note: For `bidirectional` this tensor must have a static shape.

sourceGradient: The input gradient, that is the gradient of a tensor with respect to the first output of the forward pass.

zState: The second output of MPSGraph.SingleGateRNNWithSourceTensorRecurrentWeightInputWeightBiasInitStateMaskDescriptorName with `descriptor.Training() = YES`.

inputWeight: A tensor containing the input weights matrix [W] - optional, if missing the operation assumes a diagonal unit-matrix. For `bidirectional` the layout is [2H,I] and otherwise it is [H,I].

bias: A tensor containing the bias `b` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [2H] and otherwise it is [H].

initState: The initial internal state of the RNN `h[-1]` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].

mask: A tensor containing the mask `m` - optional, if missing the operation assumes ones. This is useful for dropout support.

descriptor: A descriptor that defines the parameters for the RNN operation.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array containing gradients for each input tensor, except for `sourceGradient` and `mask`. In case an input is `nil`, no gradient will be returned for it. The order of the gradients will be: for `source`, for `recurrentWeight`, for `inputWeight`, for `bias` and finally for `initState`.

Discussion

For details of this operation and parameters, refer to documentation of MPSGraph.SingleGateRNNWithSourceTensorRecurrentWeightInputWeightBiasInitStateMaskDescriptorName.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/singleGateRNNGradients(_:recurrentWeight:sourceGradient:zState:inputWeight:bias:initState:mask:descriptor:name:)

func (MPSGraph) SingleGateRNNGradientsWithSourceTensorRecurrentWeightSourceGradientZStateStateGradientInputWeightBiasInitStateMaskDescriptorName

func (g MPSGraph) SingleGateRNNGradientsWithSourceTensorRecurrentWeightSourceGradientZStateStateGradientInputWeightBiasInitStateMaskDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, sourceGradient IMPSGraphTensor, zState IMPSGraphTensor, stateGradient IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, mask IMPSGraphTensor, descriptor IMPSGraphSingleGateRNNDescriptor, name string) []MPSGraphTensor

Creates a single-gate RNN gradient operation and returns the gradient tensor values.

source: A tensor that contains the source data `x[t]` with the data layout [T,N,I]. In case `inputWeight = nil` and `bidirectional = NO` then the layout is [T,N,H] and for `inputWeight = nil` and `bidirectional = YES` the layout is [T,N,2H].

recurrentWeight: A tensor containing the recurrent weights [R]. For `bidirectional` the layout is [2,H,H] and otherwise it is [H,H]. Note: For `bidirectional` this tensor must have a static shape.

sourceGradient: The input gradient, that is the gradient of a tensor with respect to the first output of the forward pass.

zState: The second output of MPSGraph.SingleGateRNNWithSourceTensorRecurrentWeightInputWeightBiasInitStateMaskDescriptorName with `descriptor.Training() = YES`.

stateGradient: The input gradient coming from the future timestep - optional, if missing the operation assumes zeroes.

inputWeight: A tensor containing the input weights matrix [W] - optional, if missing the operation assumes a diagonal unit-matrix. For `bidirectional` the layout is [2H,I] and otherwise it is [H,I].

bias: A tensor containing the bias `b` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [2H] and otherwise it is [H].

initState: The initial internal state of the RNN `h[-1]` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].

mask: A tensor containing the mask `m` - optional, if missing the operation assumes ones. This is useful for dropout support.

descriptor: A descriptor that defines the parameters for the RNN operation.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array containing gradients for each input tensor, except for `sourceGradient` and `mask`. In case an input is `nil`, no gradient will be returned for it. The order of the gradients will be: for `source`, for `recurrentWeight`, for `inputWeight`, for `bias` and finally for `initState`.

Discussion

For details of this operation and parameters, refer to documentation of MPSGraph.SingleGateRNNWithSourceTensorRecurrentWeightInputWeightBiasInitStateMaskDescriptorName.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/singleGateRNNGradients(_:recurrentWeight:sourceGradient:zState:stateGradient:inputWeight:bias:initState:mask:descriptor:name:)

func (MPSGraph) SingleGateRNNWithSourceTensorRecurrentWeightInitStateDescriptorName

func (g MPSGraph) SingleGateRNNWithSourceTensorRecurrentWeightInitStateDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, initState IMPSGraphTensor, descriptor IMPSGraphSingleGateRNNDescriptor, name string) []MPSGraphTensor

Creates a single-gate RNN operation and returns the value and optionally the training state tensor.

source: A tensor that contains the source data `x[t]` with the data layout [T,N,I]. In case `inputWeight = nil` and `bidirectional = NO` then the layout is [T,N,H] and for `inputWeight = nil` and `bidirectional = YES` the layout is [T,N,2H].

recurrentWeight: A tensor containing the recurrent weights [R]. For `bidirectional` the layout is [2,H,H] and otherwise it is [H,H].

initState: The initial internal state of the RNN `h[-1]` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].

descriptor: A descriptor that defines the parameters for the RNN operation.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array of size 1 or 2, depending on value of `descriptor.Training()`. The layout of the both outputs is [T,N,H] or [T,N,2H] for bidirectional.

Discussion

This operation returns tensors `h` and optionally `z` that are defined recursively as follows:

[W] is optional `inputWeight`, [R] is `recurrentWeight`, `b` is `bias`, `m` is optional `mask`, `x[t]` is `source` `h[t]` is the first output, `z[t]` is the second output (optional) and `h[-1]` is `initState`. See MPSGraphSingleGateRNNDescriptor for different `activation` options.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/singleGateRNN(_:recurrentWeight:initState:descriptor:name:)

func (MPSGraph) SingleGateRNNWithSourceTensorRecurrentWeightInputWeightBiasInitStateDescriptorName

func (g MPSGraph) SingleGateRNNWithSourceTensorRecurrentWeightInputWeightBiasInitStateDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, descriptor IMPSGraphSingleGateRNNDescriptor, name string) []MPSGraphTensor

Creates a single-gate RNN operation and returns the value and optionally the training state tensor.

source: A tensor that contains the source data `x[t]` with the data layout [T,N,I]. In case `inputWeight = nil` and `bidirectional = NO` then the layout is [T,N,H] and for `inputWeight = nil` and `bidirectional = YES` the layout is [T,N,2H].

recurrentWeight: A tensor containing the recurrent weights [R]. For `bidirectional` the layout is [2,H,H] and otherwise it is [H,H].

inputWeight: A tensor containing the input weights matrix [W] - optional, if missing the operation assumes a diagonal unit-matrix. For `bidirectional` the layout is [2H,I] and otherwise it is [H,I].

bias: A tensor containing the bias `b` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [2H] and otherwise it is [H].

initState: The initial internal state of the RNN `h[-1]` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].

descriptor: A descriptor that defines the parameters for the RNN operation.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array of size 1 or 2, depending on value of `descriptor.Training()`. The layout of the both outputs is [T,N,H] or [T,N,2H] for bidirectional.

Discussion

This operation returns tensors `h` and optionally `z` that are defined recursively as follows:

[W] is optional `inputWeight`, [R] is `recurrentWeight`, `b` is `bias`, `m` is optional `mask`, `x[t]` is `source` `h[t]` is the first output, `z[t]` is the second output (optional) and `h[-1]` is `initState`. See MPSGraphSingleGateRNNDescriptor for different `activation` options.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/singleGateRNN(_:recurrentWeight:inputWeight:bias:initState:descriptor:name:)

func (MPSGraph) SingleGateRNNWithSourceTensorRecurrentWeightInputWeightBiasInitStateMaskDescriptorName

func (g MPSGraph) SingleGateRNNWithSourceTensorRecurrentWeightInputWeightBiasInitStateMaskDescriptorName(source IMPSGraphTensor, recurrentWeight IMPSGraphTensor, inputWeight IMPSGraphTensor, bias IMPSGraphTensor, initState IMPSGraphTensor, mask IMPSGraphTensor, descriptor IMPSGraphSingleGateRNNDescriptor, name string) []MPSGraphTensor

Creates a single-gate RNN operation and returns the value and optionally the training state tensor.

source: A tensor that contains the source data `x[t]` with the data layout [T,N,I]. In case `inputWeight = nil` and `bidirectional = NO` then the layout is [T,N,H] and for `inputWeight = nil` and `bidirectional = YES` the layout is [T,N,2H].

recurrentWeight: A tensor containing the recurrent weights [R]. For `bidirectional` the layout is [2,H,H] and otherwise it is [H,H].

inputWeight: A tensor containing the input weights matrix [W] - optional, if missing the operation assumes a diagonal unit-matrix. For `bidirectional` the layout is [2H,I] and otherwise it is [H,I].

bias: A tensor containing the bias `b` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [2H] and otherwise it is [H].

initState: The initial internal state of the RNN `h[-1]` - optional, if missing the operation assumes zeroes. For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].

mask: A tensor containing the mask `m` - optional, if missing the operation assumes ones. This is useful for dropout support.

descriptor: A descriptor that defines the parameters for the RNN operation.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array of size 1 or 2, depending on value of `descriptor.Training()`. The layout of the both outputs is [T,N,H] or [T,N,2H] for bidirectional.

Discussion

This operation returns tensors `h` and optionally `z` that are defined recursively as follows:

[W] is optional `inputWeight`, [R] is `recurrentWeight`, `b` is `bias`, `m` is optional `mask`, `x[t]` is `source` `h[t]` is the first output, `z[t]` is the second output (optional) and `h[-1]` is `initState`. See MPSGraphSingleGateRNNDescriptor for different `activation` options.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/singleGateRNN(_:recurrentWeight:inputWeight:bias:initState:mask:descriptor:name:)

func (MPSGraph) SinhWithTensorName

func (g MPSGraph) SinhWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies the hyperbolic sine operation to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sinh(with:name:)

func (MPSGraph) SliceGradientTensorFwdInShapeTensorStartTensorEndTensorStrideTensorStartMaskEndMaskSqueezeMaskName

func (g MPSGraph) SliceGradientTensorFwdInShapeTensorStartTensorEndTensorStrideTensorStartMaskEndMaskSqueezeMaskName(inputGradientTensor IMPSGraphTensor, fwdInShapeTensor IMPSGraphTensor, startTensor IMPSGraphTensor, endTensor IMPSGraphTensor, strideTensor IMPSGraphTensor, startMask uint32, endMask uint32, squeezeMask uint32, name string) IMPSGraphTensor

Creates a strided-slice gradient operation and returns the result tensor.

inputGradientTensor: The input gradient.

fwdInShapeTensor: The shape of the forward pass input, that is the shape of the gradient output.

startTensor: The tensor that specifies the starting points for each dimension.

endTensor: The tensor that specifies the ending points for each dimension.

strideTensor: The tensor that specifies the strides for each dimension.

startMask: A bitmask that indicates dimensions whose `starts` values the operation should ignore.

endMask: A bitmask that indicates dimensions whose `ends` values the operation should ignore.

squeezeMask: A bitmask that indicates dimensions the operation will squeeze out from the result.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sliceGradientTensor(_:fwdInShapeTensor:start:end:strideTensor:startMask:endMask:squeezeMask:name:)

func (MPSGraph) SliceGradientTensorFwdInShapeTensorStartTensorSizeTensorSqueezeMaskName

func (g MPSGraph) SliceGradientTensorFwdInShapeTensorStartTensorSizeTensorSqueezeMaskName(inputGradientTensor IMPSGraphTensor, fwdInShapeTensor IMPSGraphTensor, startTensor IMPSGraphTensor, sizeTensor IMPSGraphTensor, squeezeMask uint32, name string) IMPSGraphTensor

Creates a slice gradient operation and returns the result tensor.

inputGradientTensor: The input gradient.

fwdInShapeTensor: The shape of the forward pass input, that is the shape of the gradient output.

startTensor: The tensor that specifies the starting points for each dimension.

sizeTensor: The tensor that specifies the size of the forward result for each dimension.

squeezeMask: A bitmask that indicates dimensions the operation will squeeze out from the result.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sliceGradientTensor(_:fwdInShapeTensor:start:sizeTensor:squeezeMask:name:)

func (MPSGraph) SliceGradientTensorFwdInShapeTensorStartsEndsStridesName

func (g MPSGraph) SliceGradientTensorFwdInShapeTensorStartsEndsStridesName(inputGradientTensor IMPSGraphTensor, fwdInShapeTensor IMPSGraphTensor, starts []foundation.NSNumber, ends []foundation.NSNumber, strides []foundation.NSNumber, name string) IMPSGraphTensor

Creates a strided-slice gradient operation and returns the result tensor.

inputGradientTensor: The input gradient.

fwdInShapeTensor: The shape of the forward pass input, that is the shape of the gradient output.

starts: An array of numbers that specify the starting points for each dimension.

ends: An array of numbers that specify the ending points for each dimension.

strides: An array of numbers that specify the strides for each dimension.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sliceGradientTensor(_:fwdInShapeTensor:starts:ends:strides:name:)

func (MPSGraph) SliceGradientTensorFwdInShapeTensorStartsEndsStridesStartMaskEndMaskSqueezeMaskName

func (g MPSGraph) SliceGradientTensorFwdInShapeTensorStartsEndsStridesStartMaskEndMaskSqueezeMaskName(inputGradientTensor IMPSGraphTensor, fwdInShapeTensor IMPSGraphTensor, starts []foundation.NSNumber, ends []foundation.NSNumber, strides []foundation.NSNumber, startMask uint32, endMask uint32, squeezeMask uint32, name string) IMPSGraphTensor

Creates a strided-slice gradient operation and returns the result tensor.

inputGradientTensor: The input gradient.

fwdInShapeTensor: The shape of the forward pass input, that is the shape of the gradient output.

starts: An array of numbers that specify the starting points for each dimension.

ends: An array of numbers that specify the ending points for each dimension.

strides: An array of numbers that specify the strides for each dimension.

startMask: A bitmask that indicates dimensions whose `starts` values the operation should ignore.

endMask: A bitmask that indicates dimensions whose `ends` values the operation should ignore.

squeezeMask: A bitmask that indicates dimensions the operation will squeeze out from the result.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sliceGradientTensor(_:fwdInShapeTensor:starts:ends:strides:startMask:endMask:squeezeMask:name:)

func (MPSGraph) SliceTensorDimensionStartLengthName

func (g MPSGraph) SliceTensorDimensionStartLengthName(tensor IMPSGraphTensor, dimensionIndex uint, start int, length int, name string) IMPSGraphTensor

Creates a slice operation and returns the result tensor.

tensor: The tensor to be sliced.

dimensionIndex: The dimension to slice.

start: The starting index of the slice, can be negative to count from the end of the tensor dimension.

length: The length of the slice.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sliceTensor(_:dimension:start:length:name:)

func (MPSGraph) SliceTensorStartTensorEndTensorStrideTensorStartMaskEndMaskSqueezeMaskName

func (g MPSGraph) SliceTensorStartTensorEndTensorStrideTensorStartMaskEndMaskSqueezeMaskName(tensor IMPSGraphTensor, startTensor IMPSGraphTensor, endTensor IMPSGraphTensor, strideTensor IMPSGraphTensor, startMask uint32, endMask uint32, squeezeMask uint32, name string) IMPSGraphTensor

Creates a strided-slice operation and returns the result tensor.

tensor: The Tensor to be sliced.

startTensor: The tensor that specifies the starting points for each dimension.

endTensor: The tensor that specifies the ending points for each dimension.

strideTensor: The tensor that specifies the strides for each dimension.

startMask: A bitmask that indicates dimensions whose `starts` values the operation should ignore.

endMask: A bitmask that indicates dimensions whose `ends` values the operation should ignore.

squeezeMask: A bitmask that indicates dimensions the operation will squeeze out from the result.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Slices a tensor starting from `startTensor`, stopping short before `endTensor` stepping `strideTensor` paces between each value. Semantics based on TensorFlow Strided Slice Op.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sliceTensor(_:start:end:strideTensor:startMask:endMask:squeezeMask:name:)

func (MPSGraph) SliceTensorStartTensorSizeTensorSqueezeMaskName

func (g MPSGraph) SliceTensorStartTensorSizeTensorSqueezeMaskName(tensor IMPSGraphTensor, startTensor IMPSGraphTensor, sizeTensor IMPSGraphTensor, squeezeMask uint32, name string) IMPSGraphTensor

Creates a slice operation and returns the result tensor.

tensor: The Tensor to be sliced.

startTensor: The tensor that specifies the starting points for each dimension.

sizeTensor: The tensor that specifies the size of the result for each dimension.

squeezeMask: A bitmask that indicates dimensions the operation will squeeze out from the result.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Slices a tensor starting from `startTensor`, stopping short before `startTensor + endTensor` stepping a single pace between each value. Semantics based on TensorFlow Strided Slice Op.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sliceTensor(_:start:sizeTensor:squeezeMask:name:)

func (MPSGraph) SliceTensorStartsEndsStridesName

func (g MPSGraph) SliceTensorStartsEndsStridesName(tensor IMPSGraphTensor, starts []foundation.NSNumber, ends []foundation.NSNumber, strides []foundation.NSNumber, name string) IMPSGraphTensor

Creates a strided-slice operation and returns the result tensor.

tensor: The tensor to be sliced.

starts: An array of numbers that specify the starting points for each dimension.

ends: An array of numbers that specify the ending points for each dimension.

strides: An array of numbers that specify the strides for each dimension.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Slices a tensor starting from `starts`, stopping short before `ends` stepping `strides` paces between each value. Semantics based on TensorFlow Strided Slice Op.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sliceTensor(_:starts:ends:strides:name:)

func (MPSGraph) SliceTensorStartsEndsStridesStartMaskEndMaskSqueezeMaskName

func (g MPSGraph) SliceTensorStartsEndsStridesStartMaskEndMaskSqueezeMaskName(tensor IMPSGraphTensor, starts []foundation.NSNumber, ends []foundation.NSNumber, strides []foundation.NSNumber, startMask uint32, endMask uint32, squeezeMask uint32, name string) IMPSGraphTensor

Creates a strided-slice operation and returns the result tensor.

tensor: The Tensor to be sliced.

starts: An array of numbers that specify the starting points for each dimension.

ends: An array of numbers that specify the ending points for each dimension.

strides: An array of numbers that specify the strides for each dimension.

startMask: A bitmask that indicates dimensions whose `starts` values the operation should ignore.

endMask: A bitmask that indicates dimensions whose `ends` values the operation should ignore.

squeezeMask: A bitmask that indicates dimensions the operation will squeeze out from the result.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Slices a tensor starting from `starts`, stopping short before `ends` stepping `strides` paces between each value. Semantics based on TensorFlow Strided Slice Op.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sliceTensor(_:starts:ends:strides:startMask:endMask:squeezeMask:name:)

func (MPSGraph) SliceUpdateDataTensorUpdateTensorStartsEndsStridesName

func (g MPSGraph) SliceUpdateDataTensorUpdateTensorStartsEndsStridesName(dataTensor IMPSGraphTensor, updateTensor IMPSGraphTensor, starts []foundation.NSNumber, ends []foundation.NSNumber, strides []foundation.NSNumber, name string) IMPSGraphTensor

Creates a strided-slice update operation with zero masks and returns the result tensor.

dataTensor: The large tensor that will receive the update.

updateTensor: The tensor with the new values that will replace values in the dataTensor.

starts: An array of numbers that specify the starting points for each dimension.

ends: An array of numbers that specify the ending points for each dimension.

strides: An array of numbers that specify the strides for each dimension.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sliceUpdateDataTensor(_:update:starts:ends:strides:name:)

func (MPSGraph) SliceUpdateDataTensorUpdateTensorStartsEndsStridesStartMaskEndMaskSqueezeMaskName

func (g MPSGraph) SliceUpdateDataTensorUpdateTensorStartsEndsStridesStartMaskEndMaskSqueezeMaskName(dataTensor IMPSGraphTensor, updateTensor IMPSGraphTensor, starts []foundation.NSNumber, ends []foundation.NSNumber, strides []foundation.NSNumber, startMask uint32, endMask uint32, squeezeMask uint32, name string) IMPSGraphTensor

Creates a strided-slice update operation and returns the result tensor.

dataTensor: The large tensor that will receive the update.

updateTensor: The tensor with the new values that will replace values in the dataTensor.

starts: An array of numbers that specify the starting points for each dimension.

ends: An array of numbers that specify the ending points for each dimension.

strides: An array of numbers that specify the strides for each dimension.

startMask: A bitmask that indicates dimensions whose `starts` values the operation should ignore.

endMask: A bitmask that indicates dimensions whose `ends` values the operation should ignore.

squeezeMask: A bitmask that indicates dimensions the operation will squeeze out from the result.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sliceUpdateDataTensor(_:update:starts:ends:strides:startMask:endMask:squeezeMask:name:)

func (MPSGraph) SliceUpdateDataTensorUpdateTensorStartsTensorEndsTensorStridesTensorName

func (g MPSGraph) SliceUpdateDataTensorUpdateTensorStartsTensorEndsTensorStridesTensorName(dataTensor IMPSGraphTensor, updateTensor IMPSGraphTensor, startsTensor IMPSGraphTensor, endsTensor IMPSGraphTensor, stridesTensor IMPSGraphTensor, name string) IMPSGraphTensor

Creates a strided-slice update operation with zero masks and returns the result tensor.

dataTensor: The large tensor that will receive the update.

updateTensor: The tensor with the new values that will replace values in the dataTensor.

startsTensor: A Tensor that contains an array of numbers that specify the starting points for each dimension.

endsTensor: A Tensor that contains an array of numbers that specify the ending points for each dimension.

stridesTensor: A Tensor that contains an array of numbers that specify the strides for each dimension.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sliceUpdateDataTensor(_:update:startsTensor:endsTensor:stridesTensor:name:)

func (MPSGraph) SliceUpdateDataTensorUpdateTensorStartsTensorEndsTensorStridesTensorStartMaskEndMaskSqueezeMaskName

func (g MPSGraph) SliceUpdateDataTensorUpdateTensorStartsTensorEndsTensorStridesTensorStartMaskEndMaskSqueezeMaskName(dataTensor IMPSGraphTensor, updateTensor IMPSGraphTensor, startsTensor IMPSGraphTensor, endsTensor IMPSGraphTensor, stridesTensor IMPSGraphTensor, startMask uint32, endMask uint32, squeezeMask uint32, name string) IMPSGraphTensor

Creates a strided-slice update operation and returns the result tensor.

dataTensor: The large tensor that will receive the update.

updateTensor: The tensor with the new values that will replace values in the dataTensor.

startsTensor: A Tensor that contains an array of numbers that specify the starting points for each dimension.

endsTensor: A Tensor that contains an array of numbers that specify the ending points for each dimension.

stridesTensor: A Tensor that contains an array of numbers that specify the strides for each dimension.

startMask: A bitmask that indicates dimensions whose `starts` values the operation should ignore.

endMask: A bitmask that indicates dimensions whose `ends` values the operation should ignore.

squeezeMask: A bitmask that indicates dimensions the operation will squeeze out from the result.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sliceUpdateDataTensor(_:update:startsTensor:endsTensor:stridesTensor:startMask:endMask:squeezeMask:name:)

func (MPSGraph) SoftMaxCrossEntropyGradientWithIncomingGradientTensorSourceTensorLabelsTensorAxisReductionTypeName

func (g MPSGraph) SoftMaxCrossEntropyGradientWithIncomingGradientTensorSourceTensorLabelsTensorAxisReductionTypeName(gradientTensor IMPSGraphTensor, sourceTensor IMPSGraphTensor, labelsTensor IMPSGraphTensor, axis int, reductionType MPSGraphLossReductionType, name string) IMPSGraphTensor

Creates the gradient of a softmax cross-entropy loss operation and returns the result tensor.

gradientTensor: The input gradientTensor. Note: in most cases this is the initial gradient tensor, which is a constant tensor with value one.

sourceTensor: The source tensor.

labelsTensor: The labels tensor.

axis: The axis over which the operation computes the softmax reduction.

reductionType: The type of reduction MPSGraph uses to reduce across all other axes than `axis`. See: MPSGraphLossReductionType.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/softMaxCrossEntropyGradient(_:source:labels:axis:reuctionType:name:)

func (MPSGraph) SoftMaxCrossEntropyWithSourceTensorLabelsTensorAxisReductionTypeName

func (g MPSGraph) SoftMaxCrossEntropyWithSourceTensorLabelsTensorAxisReductionTypeName(sourceTensor IMPSGraphTensor, labelsTensor IMPSGraphTensor, axis int, reductionType MPSGraphLossReductionType, name string) IMPSGraphTensor

Creates a softmax cross-entropy loss operation and returns the result tensor.

sourceTensor: The source tensor.

labelsTensor: The labels tensor.

axis: The axis over which the operation computes the softmax reduction.

reductionType: The type of reduction MPSGraph uses to reduce across all other axes than `axis`. See: MPSGraphLossReductionType.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

The softmax cross-entropy operation computes:

the operation performs the reduction over the `axis` dimension.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/softMaxCrossEntropy(_:labels:axis:reuctionType:name:)

func (MPSGraph) SoftMaxGradientWithIncomingGradientSourceTensorAxisName

func (g MPSGraph) SoftMaxGradientWithIncomingGradientSourceTensorAxisName(gradient IMPSGraphTensor, source IMPSGraphTensor, axis int, name string) IMPSGraphTensor

Computes the gradient of the softmax function along the specified axis using the incoming gradient tensor.

gradient: The incoming gradient tensor.

source: The input tensor.

axis: The axis along which softmax is computed.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/softMaxGradient(withIncomingGradient:sourceTensor:axis:name:)

func (MPSGraph) SoftMaxWithTensorAxisName

func (g MPSGraph) SoftMaxWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor

Computes the softmax function on the input tensor along the specified axis.

tensor: The input tensor.

axis: The axis along which softmax is computed.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/softMax(with:axis:name:)

func (MPSGraph) SortWithTensorAxisDescendingName

func (g MPSGraph) SortWithTensorAxisDescendingName(tensor IMPSGraphTensor, axis int, descending bool, name string) IMPSGraphTensor

Sorts the elements of the input tensor along the specified axis.

tensor: The input tensor

axis: The tensor dimension over which you sort the tensor

descending: If true, reverse the sort direction

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sort(_:axis:descending:name:)

func (MPSGraph) SortWithTensorAxisName

func (g MPSGraph) SortWithTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor

Sorts the elements of the input tensor along the specified axis.

tensor: The input tensor

axis: The tensor dimension over which you sort the tensor

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sort(_:axis:name:)

func (MPSGraph) SortWithTensorAxisTensorDescendingName

func (g MPSGraph) SortWithTensorAxisTensorDescendingName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, descending bool, name string) IMPSGraphTensor

Sorts the elements of the input tensor along the specified axis.

tensor: The input tensor

axisTensor: The tensor dimension over which you sort the tensor

descending: If true, reverse the sort direction

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sort(_:axisTensor:descending:name:)

func (MPSGraph) SortWithTensorAxisTensorName

func (g MPSGraph) SortWithTensorAxisTensorName(tensor IMPSGraphTensor, axisTensor IMPSGraphTensor, name string) IMPSGraphTensor

Sorts the elements of the input tensor along the specified axis.

tensor: The input tensor

axisTensor: The tensor dimension over which you sort the tensor

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sort(_:axisTensor:name:)

func (MPSGraph) SpaceToBatchTensorSpatialAxesBatchAxisBlockDimensionsUsePixelShuffleOrderName

func (g MPSGraph) SpaceToBatchTensorSpatialAxesBatchAxisBlockDimensionsUsePixelShuffleOrderName(tensor IMPSGraphTensor, spatialAxes []foundation.NSNumber, batchAxis int, blockDimensions []foundation.NSNumber, usePixelShuffleOrder bool, name string) IMPSGraphTensor

Creates a space-to-batch operation and returns the result tensor.

tensor: The input tensor.

spatialAxes: The axes that define the dimensions containing the spatial blocks.

batchAxis: The axis that defines the destination dimension, where to copy the blocks.

blockDimensions: An array of numbers that defines the size of the rectangular spatial sub-block.

usePixelShuffleOrder: A parameter that controls layout of the sub-blocks within the batch dimension.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

This operation outputs a copy of the `input` tensor, where values from the `spatialAxes` (for `usePixelShuffleOrder=YES` 1,2 or 3 axes supported, otherwise limited only by [MPSNDArray] rank limitations) dimensions are moved in spatial blocks with rectangular size defined by `blockDimensions` to the `batchAxis` dimension. Use the `usePixelShuffleOrder` parameter to control how the data within spatial blocks is ordered in the `batchAxis` dimension: with `usePixelShuffleOrder=YES` MPSGraph stores the values of the spatial blocks contiguosly within the `batchAxis` dimension, whereas otherwise they are stored interleaved with existing values in the `batchAxis` dimension. Note: This operation is the inverse of MPSGraph.BatchToSpaceTensorSpatialAxesBatchAxisBlockDimensionsUsePixelShuffleOrderName. Note: This operation is a generalization of MPSGraph.SpaceToDepth2DTensorWidthAxisHeightAxisDepthAxisBlockSizeUsePixelShuffleOrderName.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/spaceToBatch(_:spatialAxes:batchAxis:blockDimensions:usePixelShuffleOrder:name:)

func (MPSGraph) SpaceToBatchTensorSpatialAxesTensorBatchAxisTensorBlockDimensionsTensorUsePixelShuffleOrderName

func (g MPSGraph) SpaceToBatchTensorSpatialAxesTensorBatchAxisTensorBlockDimensionsTensorUsePixelShuffleOrderName(tensor IMPSGraphTensor, spatialAxesTensor IMPSGraphTensor, batchAxisTensor IMPSGraphTensor, blockDimensionsTensor IMPSGraphTensor, usePixelShuffleOrder bool, name string) IMPSGraphTensor

Creates a space-to-batch operation and returns the result tensor.

tensor: The input tensor.

spatialAxesTensor: A tensor that contains the axes that define the dimensions containing the spatial blocks.

batchAxisTensor: A tensor that contains the axis that defines the destination dimension, where to copy the blocks.

blockDimensionsTensor: A tensor that defines the size of the rectangular spatial sub-block.

usePixelShuffleOrder: A parameter that controls layout of the sub-blocks within the batch dimension.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

This operation outputs a copy of the `input` tensor, where values from the `spatialAxesTensor` (for `usePixelShuffleOrder=YES` 1,2 or 3 axes supported, otherwise limited only by [MPSNDArray] rank limitations) dimensions are moved in spatial blocks with rectangular size defined by `blockDimensionsTensor` to the `batchAxisTensor` dimension. Use the `usePixelShuffleOrder` parameter to control how the data within spatial blocks is ordered in the `batchAxisTensor` dimension: with `usePixelShuffleOrder=YES` MPSGraph stores the values of the spatial blocks contiguosly within the `batchAxisTensor` dimension, whereas otherwise they are stored interleaved with existing values in the `batchAxisTensor` dimension. Note: This operation is the inverse of MPSGraph.BatchToSpaceTensorSpatialAxesTensorBatchAxisTensorBlockDimensionsTensorUsePixelShuffleOrderName. Note: This operation is a generalization of MPSGraph.SpaceToDepth2DTensorWidthAxisTensorHeightAxisTensorDepthAxisTensorBlockSizeUsePixelShuffleOrderName.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/spaceToBatch(_:spatialAxesTensor:batchAxisTensor:blockDimensionsTensor:usePixelShuffleOrder:name:)

func (MPSGraph) SpaceToDepth2DTensorWidthAxisHeightAxisDepthAxisBlockSizeUsePixelShuffleOrderName

func (g MPSGraph) SpaceToDepth2DTensorWidthAxisHeightAxisDepthAxisBlockSizeUsePixelShuffleOrderName(tensor IMPSGraphTensor, widthAxis uint, heightAxis uint, depthAxis uint, blockSize uint, usePixelShuffleOrder bool, name string) IMPSGraphTensor

Creates a space-to-depth2D operation and returns the result tensor.

tensor: The input tensor.

widthAxis: The axis that defines the fastest running dimension within the block.

heightAxis: The axis that defines the 2nd fastest running dimension within the block.

depthAxis: The axis that defines the destination dimension, where to copy the blocks.

blockSize: The size of the square spatial sub-block.

usePixelShuffleOrder: A parameter that controls the layout of the sub-blocks within the depth dimension.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

This operation outputs a copy of the `input` tensor, where values from the `widthAxis` and `heightAxis` dimensions are moved in spatial blocks of size `blockSize` to the `depthAxis` dimension. Use the `usePixelShuffleOrder` parameter to control how the data within spatial blocks is ordered in the `depthAxis` dimension: with `usePixelShuffleOrder=YES` MPSGraph stores the values of the spatial blocks contiguosly within the `depthAxis` dimension, whereas otherwise they are stored interleaved with existing values in the `depthAxis` dimension. This operation is the inverse of `MPSGraph/depthToSpace2DTensor:widthAxis:heightAxis:depthAxis:blockSize:usePixelShuffleOrder:name:`.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/space(toDepth2DTensor:widthAxis:heightAxis:depthAxis:blockSize:usePixelShuffleOrder:name:)

func (MPSGraph) SpaceToDepth2DTensorWidthAxisTensorHeightAxisTensorDepthAxisTensorBlockSizeUsePixelShuffleOrderName

func (g MPSGraph) SpaceToDepth2DTensorWidthAxisTensorHeightAxisTensorDepthAxisTensorBlockSizeUsePixelShuffleOrderName(tensor IMPSGraphTensor, widthAxisTensor IMPSGraphTensor, heightAxisTensor IMPSGraphTensor, depthAxisTensor IMPSGraphTensor, blockSize uint, usePixelShuffleOrder bool, name string) IMPSGraphTensor

Creates a space-to-depth2D operation and returns the result tensor.

tensor: The input tensor.

widthAxisTensor: A scalar tensor that contains the axis that defines the fastest running dimension within the block.

heightAxisTensor: A scalar tensor that contains the axis that defines the 2nd fastest running dimension within the block.

depthAxisTensor: A scalar tensor that contains the axis that defines the destination dimension, where to copy the blocks.

blockSize: The size of the square spatial sub-block.

usePixelShuffleOrder: A parameter that controls the layout of the sub-blocks within the depth dimension.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

This operation outputs a copy of the `input` tensor, where values from the `widthAxisTensor` and `heightAxisTensor` dimensions are moved in spatial blocks of size `blockSize` to the `depthAxisTensor` dimension. Use the `usePixelShuffleOrder` parameter to control how the data within spatial blocks is ordered in the `depthAxisTensor` dimension: with `usePixelShuffleOrder=YES` MPSGraph stores the values of the spatial blocks contiguosly within the `depthAxisTensor` dimension, whereas otherwise they are stored interleaved with existing values in the `depthAxisTensor` dimension. This operation is the inverse of MPSGraph.DepthToSpace2DTensorWidthAxisTensorHeightAxisTensorDepthAxisTensorBlockSizeUsePixelShuffleOrderName.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/space(toDepth2DTensor:widthAxisTensor:heightAxisTensor:depthAxisTensor:blockSize:usePixelShuffleOrder:name:)

func (MPSGraph) SparseTensorWithDescriptorTensorsShapeName

func (g MPSGraph) SparseTensorWithDescriptorTensorsShapeName(sparseDescriptor IMPSGraphCreateSparseOpDescriptor, inputTensorArray []MPSGraphTensor, shape foundation.NSArray, name string) IMPSGraphTensor

Creates a sparse tensor representation.

sparseDescriptor: A sparseDescriptor.

inputTensorArray: An array of input tensors as [sparseVals, indexTensor0, indexTensor1].

shape: The shape of the sparse tensor.

name: A name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

sparseVals corresponds to non zero values in matrix. indexTensor0 and indexTensor1 are indices used for indexing into sparse data structure. For COO, indexTensor0 is x index and indexTensor1 is y index . For CSC, indexTensor0 and indexTensor1 correspond to rowIndex and colStarts respectively. For CSR, indexTensor0 and indexTensor1 correspond to colIndex and rowStarts respectively. You must set input tensors appropriately for each sparse storage type.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sparseTensor(sparseTensorWithDescriptor:tensors:shape:name:)

func (MPSGraph) SparseTensorWithTypeTensorsShapeDataTypeName

func (g MPSGraph) SparseTensorWithTypeTensorsShapeDataTypeName(sparseStorageType MPSGraphSparseStorageType, inputTensorArray []MPSGraphTensor, shape foundation.NSArray, dataType uint32, name string) IMPSGraphTensor

Creates a sparse tensor representation.

sparseStorageType: A sparseStorageType.

inputTensorArray: An array of input tensors as [sparseVals, indexTensor0, indexTensor1].

shape: The shape of the sparse tensor.

dataType: The dataType of the sparse tensor.

name: A name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

sparseVals corresponds to non zero values in matrix. indexTensor0 and indexTensor1 are indices used for indexing into sparse data structure. For COO, indexTensor0 is x index and indexTensor1 is y index. For CSC, indexTensor0 and indexTensor1 correspond to rowIndex and colStarts respectively. For CSR, indexTensor0 and indexTensor1 correspond to colIndex and rowStarts respectively. You must set input tensors appropriately for each sparse storage type.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/sparseTensor(sparseTensorWithType:tensors:shape:dataType:name:)

func (MPSGraph) SplitTensorNumSplitsAxisName

func (g MPSGraph) SplitTensorNumSplitsAxisName(tensor IMPSGraphTensor, numSplits uint, axis int, name string) []MPSGraphTensor

Creates a split operation and returns the result tensor.

tensor: The input tensor.

numSplits: The number of result tensors to split to.

axis: The dimension along which MPSGraph splits the input tensor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Splits the input tensor along `axis` into `numsplits` result tensors of equal size. Requires that the lenth of the input along `axis` is divisible by `numSplits`.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/split(_:numSplits:axis:name:)

func (MPSGraph) SplitTensorSplitSizesAxisName

func (g MPSGraph) SplitTensorSplitSizesAxisName(tensor IMPSGraphTensor, splitSizes []foundation.NSNumber, axis int, name string) []MPSGraphTensor

Creates a split operation and returns the result tensor.

tensor: The input tensor.

splitSizes: The lengths of the result tensors along the split axis.

axis: The dimension along which MPSGraph splits the input tensor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Splits the input tensor along `axis` into multiple result tensors of size determined by `splitSizes`. Requires that the sum of `splitSizes` is equal to the lenth of the input along `axis`.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/split(_:splitSizes:axis:name:)

func (MPSGraph) SplitTensorSplitSizesTensorAxisName

func (g MPSGraph) SplitTensorSplitSizesTensorAxisName(tensor IMPSGraphTensor, splitSizesTensor IMPSGraphTensor, axis int, name string) []MPSGraphTensor

Creates a split operation and returns the result tensor.

tensor: The input tensor

splitSizesTensor: The lengths of the result tensors along the split axis.

axis: The dimension along which MPSGraph splits the input tensor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Splits the input tensor along `axis` into multiple result tensors of size determined by `splitSizesTensor`. Requires that the sum of the elements of `splitSizesTensor` is equal to the lenth of the input along `axis`.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/split(_:splitSizesTensor:axis:name:)

func (MPSGraph) SquareRootWithTensorName

func (g MPSGraph) SquareRootWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies the square root operation to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/squareRoot(with:name:)

func (MPSGraph) SquareWithTensorName

func (g MPSGraph) SquareWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies the square operation to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/square(with:name:)

func (MPSGraph) SqueezeTensorAxesName

func (g MPSGraph) SqueezeTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor

Creates a squeeze operation and returns the result tensor.

tensor: The input tensor.

axes: The axes to squeeze.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Squeezes the tensor, removing dimensions with size 1 at specified axes. The size of the input tensor must be 1 at all specified axes.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/squeeze(_:axes:name:)

func (MPSGraph) SqueezeTensorAxesTensorName

func (g MPSGraph) SqueezeTensorAxesTensorName(tensor IMPSGraphTensor, axesTensor IMPSGraphTensor, name string) IMPSGraphTensor

Creates a squeeze operation and returns the result tensor.

tensor: The input tensor.

axesTensor: The tensor containing the axes to squeeze.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object

Discussion

Squeezes the tensor, removing dimensions with size 1 at specified axes. The size of the input tensor must be 1 at all specified axes.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/squeeze(_:axesTensor:name:)

func (MPSGraph) SqueezeTensorAxisName

func (g MPSGraph) SqueezeTensorAxisName(tensor IMPSGraphTensor, axis int, name string) IMPSGraphTensor

Creates a squeeze operation and returns the result tensor.

tensor: The input tensor.

axis: The axis to squeeze.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Squeezes the tensor, removing a dimension with size 1 at the specified axis. The size of the input tensor must be 1 at the specified axis.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/squeeze(_:axis:name:)

func (MPSGraph) SqueezeTensorName

func (g MPSGraph) SqueezeTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Creates a squeeze operation and returns the result tensor.

tensor: The input tensor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Squeezes the tensor, removing all dimensions with size 1.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/squeeze(_:name:)

func (MPSGraph) StackTensorsAxisName

func (g MPSGraph) StackTensorsAxisName(inputTensors []MPSGraphTensor, axis int, name string) IMPSGraphTensor

Creates a stack operation and returns the result tensor.

inputTensors: The input tensors.

axis: The dimension to stack tensors into result. Must be in range: `-rank + 1 <= dimension < rank + 1`.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Stacks all input tensors along `axis` into a result tensor of `rank + 1`. Tensors must be broadcast compatible along all dimensions except `axis`, and have the same type.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/stack(_:axis:name:)

func (MPSGraph) StencilWithSourceTensorWeightsTensorDescriptorName

func (g MPSGraph) StencilWithSourceTensorWeightsTensorDescriptorName(source IMPSGraphTensor, weights IMPSGraphTensor, descriptor IMPSGraphStencilOpDescriptor, name string) IMPSGraphTensor

Creates a stencil operation and returns the result tensor.

source: The tensor containing the source data. Must be of rank 4 or greater.

weights: A 4-D tensor containing the weights data.

descriptor: The descriptor object that specifies the parameters for the stencil operation.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Performs a weighted reduction operation (See MPSGraphStencilOpDescriptor.ReductionMode) on the last 4 dimensions of the `source` over the window determined by `weights`, according to the value defined in `descriptor`.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/stencil(withSourceTensor:weightsTensor:descriptor:name:)

func (MPSGraph) StochasticGradientDescentWithLearningRateTensorValuesTensorGradientTensorName

func (g MPSGraph) StochasticGradientDescentWithLearningRateTensorValuesTensorGradientTensorName(learningRateTensor IMPSGraphTensor, valuesTensor IMPSGraphTensor, gradientTensor IMPSGraphTensor, name string) IMPSGraphTensor

The Stochastic gradient descent performs a gradient descent.

learningRateTensor: Scalar tensor which indicates the learning rate to use with the optimizer

valuesTensor: Values tensor, usually representing the trainable parameters

gradientTensor: Partial gradient of the trainable parameters with respect to loss

name: Name for the operation

Return Value

A valid MPSGraphTensor object.

Discussion

`variable = variable - (learningRate * g)` where, `g` is gradient of error wrt variable

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/stochasticGradientDescent(learningRate:values:gradient:name:)

func (MPSGraph) SubtractionWithPrimaryTensorSecondaryTensorName

func (g MPSGraph) SubtractionWithPrimaryTensorSecondaryTensorName(primaryTensor IMPSGraphTensor, secondaryTensor IMPSGraphTensor, name string) IMPSGraphTensor

Subtracts the second input tensor from the first.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/subtraction(_:_:name:)

func (MPSGraph) TanWithTensorName

func (g MPSGraph) TanWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies the tangent operation to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/tan(with:name:)

func (MPSGraph) TanhWithTensorName

func (g MPSGraph) TanhWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies the hyperbolic tangent operation to the input tensor elements.

tensor: The input tensor.

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.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/tanh(with:name:)

func (MPSGraph) TileGradientWithIncomingGradientTensorSourceTensorWithMultiplierName

func (g MPSGraph) TileGradientWithIncomingGradientTensorSourceTensorWithMultiplierName(incomingGradientTensor IMPSGraphTensor, sourceTensor IMPSGraphTensor, multiplier foundation.NSArray, name string) IMPSGraphTensor

Creates a tile gradient operation and returns the result tensor.

incomingGradientTensor: The input gradient tensor.

sourceTensor: The input tensor of the forward pass.

multiplier: An array of numbers that specifies how many copies per dimension MPSGraph produced in the forward pass.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/tileGradient(withIncomingGradientTensor:sourceTensor:withMultiplier:name:)

func (MPSGraph) TileTensorWithMultiplierName

func (g MPSGraph) TileTensorWithMultiplierName(tensor IMPSGraphTensor, multiplier foundation.NSArray, name string) IMPSGraphTensor

Creates a tile operation and returns the result tensor.

tensor: The input tensor

multiplier: An array of numbers that specifies how many copies per dimension MPSGraph produces.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Creates a tensor which contains multiple copies of the input tensor along each dimension of the tensor.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/tileTensor(_:withMultiplier:name:)

func (MPSGraph) TopKWithGradientTensorSourceAxisKName

func (g MPSGraph) TopKWithGradientTensorSourceAxisKName(gradient IMPSGraphTensor, source IMPSGraphTensor, axis int, k uint, name string) IMPSGraphTensor

Creates a TopKGradient operation and returns the result tensor.

gradient: Tensor containing the incoming gradient.

source: Tensor containing source data.

axis: The dimension along which to compute the TopK values..

k: The number of largest values to return.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Finds the K largest values along the minor dimension of the input. The input must have at least K elements along its minor dimension.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/topKGradient(_:source:axis:k:name:)

func (MPSGraph) TopKWithGradientTensorSourceAxisTensorKTensorName

func (g MPSGraph) TopKWithGradientTensorSourceAxisTensorKTensorName(gradient IMPSGraphTensor, source IMPSGraphTensor, axisTensor IMPSGraphTensor, kTensor IMPSGraphTensor, name string) IMPSGraphTensor

Creates a TopKGradient operation and returns the result tensor.

gradient: Tensor containing the incoming gradient.

source: Tensor containing source data.

axisTensor: Tensor containing the dimension along which to compute the TopK values.

kTensor: Tensor of the number of largest values to return.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Finds the K largest values along the minor dimension of the input. The input must have at least K elements along its minor dimension.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/topKGradient(_:source:axisTensor:kTensor:name:)

func (MPSGraph) TopKWithGradientTensorSourceKName

func (g MPSGraph) TopKWithGradientTensorSourceKName(gradient IMPSGraphTensor, source IMPSGraphTensor, k uint, name string) IMPSGraphTensor

Creates a TopKGradient operation and returns the result tensor.

gradient: Tensor containing the incoming gradient.

source: Tensor containing source data.

k: The number of largest values to return.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Finds the K largest values along the minor dimension of the input. The input must have at least K elements along its minor dimension.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/topKGradient(_:input:k:name:)

func (MPSGraph) TopKWithGradientTensorSourceKTensorName

func (g MPSGraph) TopKWithGradientTensorSourceKTensorName(gradient IMPSGraphTensor, source IMPSGraphTensor, kTensor IMPSGraphTensor, name string) IMPSGraphTensor

Creates a TopKGradient operation and returns the result tensor.

gradient: Tensor containing the incoming gradient.

source: Tensor containing source data.

kTensor: Tensor of the number of largest values to return.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Finds the K largest values along the minor dimension of the input. The input must have at least K elements along its minor dimension.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/topKGradient(_:input:kTensor:name:)

func (MPSGraph) TopKWithSourceTensorAxisKName

func (g MPSGraph) TopKWithSourceTensorAxisKName(source IMPSGraphTensor, axis int, k uint, name string) []MPSGraphTensor

Creates a TopK operation and returns the value and indices tensors.

source: Tensor containing source data.

axis: The dimension along which to compute the TopK values.

k: The number of largest values to return.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array of size 2.

Discussion

Finds the k largest values along the minor dimension of the input. The source must have at least k elements along its minor dimension. The first element of the result array corresponds to the top values, and the second array corresponds to the indices of the top values.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/topK(_:axis:k:name:)

func (MPSGraph) TopKWithSourceTensorAxisTensorKTensorName

func (g MPSGraph) TopKWithSourceTensorAxisTensorKTensorName(source IMPSGraphTensor, axisTensor IMPSGraphTensor, kTensor IMPSGraphTensor, name string) []MPSGraphTensor

Creates a TopK operation and returns the result tensor.

source: Tensor containing source data.

axisTensor: Tensor containing the dimension along which to compute the TopK values.

kTensor: Tensor of the number of largest values to return.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array of size 2.

Discussion

Finds the k largest values along the minor dimension of the input. The source must have at least k elements along its minor dimension. The first element of the result array corresponds to the top values, and the second array corresponds to the indices of the top values.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/topK(_:axisTensor:kTensor:name:)

func (MPSGraph) TopKWithSourceTensorKName

func (g MPSGraph) TopKWithSourceTensorKName(source IMPSGraphTensor, k uint, name string) []MPSGraphTensor

Creates a TopK operation and returns the value and indices tensors

source: Tensor containing source data

k: The number of largest values to return

name: The name for the operation.

Return Value

A valid MPSGraphTensor array of size 2

Discussion

Finds the k largest values along the minor dimension of the input. The source must have at least k elements along its minor dimension. The first element of the result array corresponds to the top values, and the second element of the result array corresponds to the indices of the top values.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/topK(_:k:name:)

func (MPSGraph) TopKWithSourceTensorKTensorName

func (g MPSGraph) TopKWithSourceTensorKTensorName(source IMPSGraphTensor, kTensor IMPSGraphTensor, name string) []MPSGraphTensor

Creates a TopK operation and returns the result tensor.

source: Tensor containing source data.

kTensor: Tensor of the number of largest values to return.

name: The name for the operation.

Return Value

A valid MPSGraphTensor array of size 2.

Discussion

Finds the k largest values along the minor dimension of the input. The source must have at least k elements along its minor dimension. The first element of the result array corresponds to the top values, and the second element of the result array corresponds to the indices of the top values.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/topK(_:kTensor:name:)

func (MPSGraph) TransposeTensorDimensionWithDimensionName

func (g MPSGraph) TransposeTensorDimensionWithDimensionName(tensor IMPSGraphTensor, dimensionIndex uint, dimensionIndex2 uint, name string) IMPSGraphTensor

Creates a transpose operation and returns the result tensor.

tensor: The tensor to be transposed.

dimensionIndex: The first dimension index to be transposed.

dimensionIndex2: The second dimension index to be transposed.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Transposes the dimensions `dimensionIndex` and `dimensionIndex2` of the input tensor.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/transposeTensor(_:dimension:withDimension:name:)

func (MPSGraph) TransposeTensorPermutationName

func (g MPSGraph) TransposeTensorPermutationName(tensor IMPSGraphTensor, permutation []foundation.NSNumber, name string) IMPSGraphTensor

Creates a permutation operation and returns the result tensor.

tensor: The tensor to be permuted.

permutation: An array of numbers defining the permutation, must be of length `rank(tensor)` and define a valid permutation.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Permutes the dimensions of the input tensor according to values in `permutation`.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/transpose(_:permutation:name:)

func (MPSGraph) TruncateWithTensorName

func (g MPSGraph) TruncateWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Applies the truncate operation to the input tensor elements.

tensor: The input tensor.

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 applies the floor operation to positive inputs and ceiling operation to negative inputs.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/truncate(_:name:)

func (MPSGraph) VariableFromTensorWithTensorName

func (g MPSGraph) VariableFromTensorWithTensorName(tensor IMPSGraphTensor, name string) IMPSGraphTensor

Creates a variable from an input tensor.

tensor: The tensor from which to form the variable.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/variableFromTensor(_:name:)

func (MPSGraph) VariableWithDataShapeDataTypeName

func (g MPSGraph) VariableWithDataShapeDataTypeName(data foundation.NSData, shape foundation.NSArray, dataType uint32, name string) IMPSGraphTensor

Creates a variable operation and returns the result tensor.

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 the constant tensor.

name: The name for the operation.

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/variable(with:shape:dataType:name:)

func (MPSGraph) VarianceOfTensorAxesName

func (g MPSGraph) VarianceOfTensorAxesName(tensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor

Returns the variance of the first input along the specified axes.

axes: A list of axes over which to perform the reduction. Tthe order of dimensions goes from the slowest moving at axis=0 to the fastest moving dimension.

name: An optional name for the operation.

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/variance(of:axes:name:)

func (MPSGraph) VarianceOfTensorMeanTensorAxesName

func (g MPSGraph) VarianceOfTensorMeanTensorAxesName(tensor IMPSGraphTensor, meanTensor IMPSGraphTensor, axes []foundation.NSNumber, name string) IMPSGraphTensor

Returns the variance of the first input along the specified axes when the mean has been precomputed.

axes: A list of axes over which to perform the reduction such that the order of dimensions goes from the slowest moving at axis=0 to the fastest moving dimension.

name: An optional name for the operation.

Return Value

A valid MPSGraphTensor object.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraph/variance(of:mean:axes:name:)

type MPSGraphCallableMap

type MPSGraphCallableMap = foundation.INSDictionary

MPSGraphCallableMap is a dictionary of symbol names and the corresponding executables for them.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphCallableMap

type MPSGraphClass

type MPSGraphClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphClass

func GetMPSGraphClass() MPSGraphClass

GetMPSGraphClass returns the class object for MPSGraph.

func (MPSGraphClass) Alloc

func (mc MPSGraphClass) Alloc() MPSGraph

Alloc allocates memory for a new instance of the class.

func (MPSGraphClass) Class

func (mc MPSGraphClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type MPSGraphCompilationCompletionHandler

type MPSGraphCompilationCompletionHandler = func(executable MPSGraphExecutable, error_ foundation.NSError)

MPSGraphCompilationCompletionHandler is a notification that appears when compilation finishes.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphCompilationCompletionHandler

type MPSGraphCompilationDescriptor

type MPSGraphCompilationDescriptor struct {
	MPSGraphObject
}

A class that consists of all the levers for compiling graphs.

Instance Properties

Instance Methods

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphCompilationDescriptor

func MPSGraphCompilationDescriptorFromID

func MPSGraphCompilationDescriptorFromID(id objc.ID) MPSGraphCompilationDescriptor

MPSGraphCompilationDescriptorFromID constructs a MPSGraphCompilationDescriptor from an objc.ID.

A class that consists of all the levers for compiling graphs.

func NewMPSGraphCompilationDescriptor

func NewMPSGraphCompilationDescriptor() MPSGraphCompilationDescriptor

NewMPSGraphCompilationDescriptor creates a new MPSGraphCompilationDescriptor instance.

func (MPSGraphCompilationDescriptor) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphCompilationDescriptor) Callables

The dictionary used during runtime to lookup the MPSGraphExecutable which correspond to the `symbolName`.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphCompilationDescriptor/callables

func (MPSGraphCompilationDescriptor) CompilationCompletionHandler

func (g MPSGraphCompilationDescriptor) CompilationCompletionHandler() MPSGraphExecutableErrorHandler

The handler that the graph calls when the compilation completes.

Discussion

Default value is nil.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphCompilationDescriptor/compilationCompletionHandler

func (MPSGraphCompilationDescriptor) DisableTypeInference

func (g MPSGraphCompilationDescriptor) DisableTypeInference()

Turns off type inference and relies on type inference during runtime.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphCompilationDescriptor/disableTypeInference()

func (MPSGraphCompilationDescriptor) DispatchQueue

func (g MPSGraphCompilationDescriptor) DispatchQueue() dispatch.Queue

The dispatch queue used for the compilation.

Discussion

Default value is nil.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphCompilationDescriptor/dispatchQueue

func (MPSGraphCompilationDescriptor) Init

Init initializes the instance.

func (MPSGraphCompilationDescriptor) OptimizationLevel

The optimization level for the graph execution, default is MPSGraphOptimizationLevel1.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphCompilationDescriptor/optimizationLevel

func (MPSGraphCompilationDescriptor) OptimizationProfile

The optimization profile for the graph optimization.

Discussion

Default is MPSGraphOptimizationProfilePerformance.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphCompilationDescriptor/optimizationProfile

func (MPSGraphCompilationDescriptor) ReducedPrecisionFastMath

Across the executable allow reduced precision fast math optimizations.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphCompilationDescriptor/reducedPrecisionFastMath

func (MPSGraphCompilationDescriptor) SetCallables

func (g MPSGraphCompilationDescriptor) SetCallables(value MPSGraphCallableMap)

func (MPSGraphCompilationDescriptor) SetCompilationCompletionHandler

func (g MPSGraphCompilationDescriptor) SetCompilationCompletionHandler(value MPSGraphExecutableErrorHandler)

func (MPSGraphCompilationDescriptor) SetDispatchQueue

func (g MPSGraphCompilationDescriptor) SetDispatchQueue(value dispatch.Queue)

func (MPSGraphCompilationDescriptor) SetOptimizationLevel

func (g MPSGraphCompilationDescriptor) SetOptimizationLevel(value MPSGraphOptimization)

func (MPSGraphCompilationDescriptor) SetOptimizationProfile

func (g MPSGraphCompilationDescriptor) SetOptimizationProfile(value MPSGraphOptimizationProfile)

func (MPSGraphCompilationDescriptor) SetReducedPrecisionFastMath

func (g MPSGraphCompilationDescriptor) SetReducedPrecisionFastMath(value MPSGraphReducedPrecisionFastMath)

func (MPSGraphCompilationDescriptor) SetWaitForCompilationCompletion

func (g MPSGraphCompilationDescriptor) SetWaitForCompilationCompletion(value bool)

func (MPSGraphCompilationDescriptor) WaitForCompilationCompletion

func (g MPSGraphCompilationDescriptor) WaitForCompilationCompletion() bool

Flag that makes the compile or specialize call blocking till the entire compilation is complete, defaults to NO.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphCompilationDescriptor/waitForCompilationCompletion

type MPSGraphCompilationDescriptorClass

type MPSGraphCompilationDescriptorClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphCompilationDescriptorClass

func GetMPSGraphCompilationDescriptorClass() MPSGraphCompilationDescriptorClass

GetMPSGraphCompilationDescriptorClass returns the class object for MPSGraphCompilationDescriptor.

func (MPSGraphCompilationDescriptorClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphCompilationDescriptorClass) Class

Class returns the underlying Objective-C class pointer.

type MPSGraphCompletionHandler

type MPSGraphCompletionHandler = func(resultsDictionary foundation.INSDictionary, error_ foundation.NSError)

MPSGraphCompletionHandler is a notification that appears when graph execution finishes.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphCompletionHandler

type MPSGraphControlFlowDependencyBlock

type MPSGraphControlFlowDependencyBlock = func() []MPSGraphTensor

MPSGraphControlFlowDependencyBlock is the scope where all the operations defined in this block get control-dependency operations.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphControlFlowDependencyBlock

type MPSGraphConvolution2DOpDescriptor

type MPSGraphConvolution2DOpDescriptor struct {
	MPSGraphObject
}

A class that describes the properties of a 2D-convolution operator.

Overview

Use an instance of this class is to add a 2D-convolution operator with the desired properties to the graph.

Instance Properties

Instance Methods

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution2DOpDescriptor

func MPSGraphConvolution2DOpDescriptorFromID

func MPSGraphConvolution2DOpDescriptorFromID(id objc.ID) MPSGraphConvolution2DOpDescriptor

MPSGraphConvolution2DOpDescriptorFromID constructs a MPSGraphConvolution2DOpDescriptor from an objc.ID.

A class that describes the properties of a 2D-convolution operator.

func NewGraphConvolution2DOpDescriptorWithStrideInXStrideInYDilationRateInXDilationRateInYGroupsPaddingLeftPaddingRightPaddingTopPaddingBottomPaddingStyleDataLayoutWeightsLayout

func NewGraphConvolution2DOpDescriptorWithStrideInXStrideInYDilationRateInXDilationRateInYGroupsPaddingLeftPaddingRightPaddingTopPaddingBottomPaddingStyleDataLayoutWeightsLayout(strideInX uint, strideInY uint, dilationRateInX uint, dilationRateInY uint, groups uint, paddingLeft uint, paddingRight uint, paddingTop uint, paddingBottom uint, paddingStyle MPSGraphPaddingStyle, dataLayout MPSGraphTensorNamedDataLayout, weightsLayout MPSGraphTensorNamedDataLayout) MPSGraphConvolution2DOpDescriptor

Creates a convolution descriptor with given values for parameters.

strideInX: See MPSGraphConvolution2DOpDescriptor.StrideInX property.

strideInY: See MPSGraphConvolution2DOpDescriptor.StrideInY property.

dilationRateInX: See MPSGraphConvolution2DOpDescriptor.DilationRateInX property.

dilationRateInY: See MPSGraphConvolution2DOpDescriptor.DilationRateInY property.

groups: See MPSGraphConvolution2DOpDescriptor.Groups property.

paddingLeft: See MPSGraphConvolution2DOpDescriptor.PaddingLeft property.

paddingRight: See MPSGraphConvolution2DOpDescriptor.PaddingRight property.

paddingTop: See MPSGraphConvolution2DOpDescriptor.PaddingTop property.

paddingBottom: See MPSGraphConvolution2DOpDescriptor.PaddingBottom property.

paddingStyle: See MPSGraphConvolution2DOpDescriptor.PaddingStyle property.

dataLayout: See MPSGraphConvolution2DOpDescriptor.DataLayout property.

weightsLayout: See MPSGraphConvolution2DOpDescriptor.WeightsLayout property.

Return Value

The MPSGraphConvolution2DOpDescriptor on autoreleasepool.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution2DOpDescriptor/init(strideInX:strideInY:dilationRateInX:dilationRateInY:groups:paddingLeft:paddingRight:paddingTop:paddingBottom:paddingStyle:dataLayout:weightsLayout:)

func NewGraphConvolution2DOpDescriptorWithStrideInXStrideInYDilationRateInXDilationRateInYGroupsPaddingStyleDataLayoutWeightsLayout

func NewGraphConvolution2DOpDescriptorWithStrideInXStrideInYDilationRateInXDilationRateInYGroupsPaddingStyleDataLayoutWeightsLayout(strideInX uint, strideInY uint, dilationRateInX uint, dilationRateInY uint, groups uint, paddingStyle MPSGraphPaddingStyle, dataLayout MPSGraphTensorNamedDataLayout, weightsLayout MPSGraphTensorNamedDataLayout) MPSGraphConvolution2DOpDescriptor

Creates a convolution descriptor with given values for parameters.

strideInX: See MPSGraphConvolution2DOpDescriptor.StrideInX property.

strideInY: See MPSGraphConvolution2DOpDescriptor.StrideInY property.

dilationRateInX: See MPSGraphConvolution2DOpDescriptor.DilationRateInX property.

dilationRateInY: See MPSGraphConvolution2DOpDescriptor.DilationRateInY property.

groups: See MPSGraphConvolution2DOpDescriptor.Groups property.

paddingStyle: See MPSGraphConvolution2DOpDescriptor.PaddingStyle property.

dataLayout: See MPSGraphConvolution2DOpDescriptor.DataLayout property.

weightsLayout: See MPSGraphConvolution2DOpDescriptor.WeightsLayout property.

Return Value

The MPSGraphConvolution2DOpDescriptor on autoreleasepool.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution2DOpDescriptor/init(strideInX:strideInY:dilationRateInX:dilationRateInY:groups:paddingStyle:dataLayout:weightsLayout:)

func NewMPSGraphConvolution2DOpDescriptor

func NewMPSGraphConvolution2DOpDescriptor() MPSGraphConvolution2DOpDescriptor

NewMPSGraphConvolution2DOpDescriptor creates a new MPSGraphConvolution2DOpDescriptor instance.

func (MPSGraphConvolution2DOpDescriptor) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphConvolution2DOpDescriptor) DataLayout

The named layout of data in the source tensor.

Discussion

It defines the order of named dimensions (Batch, Channel, Height, Width). The convolution operation uses this to interpret data in the source tensor. For example, if `dataLayout` is MPSGraphTensorNamedDataLayoutNCHW, frameork interprets data in source tensor as `batch x channels x height x width` with `width` as fastest moving dimension.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution2DOpDescriptor/dataLayout

func (MPSGraphConvolution2DOpDescriptor) DilationRateInX

func (g MPSGraphConvolution2DOpDescriptor) DilationRateInX() uint

The amount by which the weights tensor expands in the `x`-direction.

Discussion

The weights tensor is dilated by inserting `dilationRateInX-1` zeros between consecutive values in `x`-dimension. Dilated weights tensor width is `(dilationRateInX-1)*kernelWidth+1`. Default value is 1.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution2DOpDescriptor/dilationRateInX

func (MPSGraphConvolution2DOpDescriptor) DilationRateInY

func (g MPSGraphConvolution2DOpDescriptor) DilationRateInY() uint

The amount by which the weights tensor expands in the `y`-direction.

Discussion

The weights tensor is dilated by inserting `dilationRateInY-1` zeros between consecutive values in `y`-dimension. Dilated weights tensor width is `(dilationRateInY-1)*kernelHeight+1`. Default value is 1.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution2DOpDescriptor/dilationRateInY

func (MPSGraphConvolution2DOpDescriptor) Groups

The number of partitions of the input and output channels.

Discussion

The convolution operation divides input and output channels in `groups` partitions. input channels in a group or partition are only connected to output channels in corresponding group. Number of weights the convolution needs is `outputFeatureChannels x inputFeatureChannels/groups x kernelWidth x kernelHeight`

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution2DOpDescriptor/groups

func (MPSGraphConvolution2DOpDescriptor) Init

Init initializes the instance.

func (MPSGraphConvolution2DOpDescriptor) PaddingBottom

func (g MPSGraphConvolution2DOpDescriptor) PaddingBottom() uint

The number of zeros added at the bottom of the source tensor.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution2DOpDescriptor/paddingBottom

func (MPSGraphConvolution2DOpDescriptor) PaddingLeft

func (g MPSGraphConvolution2DOpDescriptor) PaddingLeft() uint

The number of zeros added on the left side of the source tensor.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution2DOpDescriptor/paddingLeft

func (MPSGraphConvolution2DOpDescriptor) PaddingRight

func (g MPSGraphConvolution2DOpDescriptor) PaddingRight() uint

The number of zeros added on the right side of the source tensor.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution2DOpDescriptor/paddingRight

func (MPSGraphConvolution2DOpDescriptor) PaddingStyle

The type of padding applied to the source tensor.

Discussion

If paddingStyle is MPSGraphPaddingStyleExplicit, `paddingLeft`, `laddingRight`, `paddingTop`, and `paddingBottom` must to be specified. For all other padding styles, framework compute these values so you dont need to provide these values.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution2DOpDescriptor/paddingStyle

func (MPSGraphConvolution2DOpDescriptor) PaddingTop

func (g MPSGraphConvolution2DOpDescriptor) PaddingTop() uint

The number of zeros added at the top of the source tensor.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution2DOpDescriptor/paddingTop

func (MPSGraphConvolution2DOpDescriptor) SetDataLayout

func (MPSGraphConvolution2DOpDescriptor) SetDilationRateInX

func (g MPSGraphConvolution2DOpDescriptor) SetDilationRateInX(value uint)

func (MPSGraphConvolution2DOpDescriptor) SetDilationRateInY

func (g MPSGraphConvolution2DOpDescriptor) SetDilationRateInY(value uint)

func (MPSGraphConvolution2DOpDescriptor) SetExplicitPaddingWithPaddingLeftPaddingRightPaddingTopPaddingBottom

func (g MPSGraphConvolution2DOpDescriptor) SetExplicitPaddingWithPaddingLeftPaddingRightPaddingTopPaddingBottom(paddingLeft uint, paddingRight uint, paddingTop uint, paddingBottom uint)

Sets the left, right, top, and bottom padding values.

paddingLeft: See MPSGraphConvolution2DOpDescriptor.PaddingLeft property.

paddingRight: See MPSGraphConvolution2DOpDescriptor.PaddingRight property.

paddingTop: See MPSGraphConvolution2DOpDescriptor.PaddingTop property.

paddingBottom: See MPSGraphConvolution2DOpDescriptor.PaddingBottom property.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution2DOpDescriptor/setExplicitPaddingWithPaddingLeft(_:paddingRight:paddingTop:paddingBottom:)

func (MPSGraphConvolution2DOpDescriptor) SetGroups

func (g MPSGraphConvolution2DOpDescriptor) SetGroups(value uint)

func (MPSGraphConvolution2DOpDescriptor) SetPaddingBottom

func (g MPSGraphConvolution2DOpDescriptor) SetPaddingBottom(value uint)

func (MPSGraphConvolution2DOpDescriptor) SetPaddingLeft

func (g MPSGraphConvolution2DOpDescriptor) SetPaddingLeft(value uint)

func (MPSGraphConvolution2DOpDescriptor) SetPaddingRight

func (g MPSGraphConvolution2DOpDescriptor) SetPaddingRight(value uint)

func (MPSGraphConvolution2DOpDescriptor) SetPaddingStyle

func (MPSGraphConvolution2DOpDescriptor) SetPaddingTop

func (g MPSGraphConvolution2DOpDescriptor) SetPaddingTop(value uint)

func (MPSGraphConvolution2DOpDescriptor) SetStrideInX

func (g MPSGraphConvolution2DOpDescriptor) SetStrideInX(value uint)

func (MPSGraphConvolution2DOpDescriptor) SetStrideInY

func (g MPSGraphConvolution2DOpDescriptor) SetStrideInY(value uint)

func (MPSGraphConvolution2DOpDescriptor) SetWeightsLayout

func (MPSGraphConvolution2DOpDescriptor) StrideInX

The scale that maps `x`-coordinate of the destination to `x`-coordinate of the source.

Discussion

Source `x`-coordinate, `sx` is computed from destination `x`-coordinate, `dx` as `sx = strideInX*dx`. Default value is 1.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution2DOpDescriptor/strideInX

func (MPSGraphConvolution2DOpDescriptor) StrideInY

The scale that maps `y`-coordinate of the destination to `y`-coordinate of the source.

Discussion

Source `y`-coordinate, `sy` is computed from destination `y`-coordinate, `dy` as `sy = strideInY*dy`. Default value is 1.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution2DOpDescriptor/strideInY

func (MPSGraphConvolution2DOpDescriptor) WeightsLayout

The named layout of data in the weights tensor.

Discussion

It defines the order of named dimensions (Output channels, Input channels, Kernel height, Kernel width). The convolution operation uses this to interpret data in the weights tensor. For example, if `weightsLayout` is MPSGraphTensorNamedDataLayoutOIHW, frameork interprets data in weights tensor as `outputChannels x inputChannels x kernelHeight x kernelWidth` with `kernelWidth` as fastest moving dimension.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution2DOpDescriptor/weightsLayout

type MPSGraphConvolution2DOpDescriptorClass

type MPSGraphConvolution2DOpDescriptorClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphConvolution2DOpDescriptorClass

func GetMPSGraphConvolution2DOpDescriptorClass() MPSGraphConvolution2DOpDescriptorClass

GetMPSGraphConvolution2DOpDescriptorClass returns the class object for MPSGraphConvolution2DOpDescriptor.

func (MPSGraphConvolution2DOpDescriptorClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphConvolution2DOpDescriptorClass) Class

Class returns the underlying Objective-C class pointer.

type MPSGraphConvolution3DOpDescriptor

type MPSGraphConvolution3DOpDescriptor struct {
	MPSGraphObject
}

A class that describes the properties of a 3D-convolution operator.

Overview

Use an instance of this class is to add a 3D-convolution operator with desired properties to the graph.

Instance Properties

Instance Methods

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution3DOpDescriptor

func MPSGraphConvolution3DOpDescriptorFromID

func MPSGraphConvolution3DOpDescriptorFromID(id objc.ID) MPSGraphConvolution3DOpDescriptor

MPSGraphConvolution3DOpDescriptorFromID constructs a MPSGraphConvolution3DOpDescriptor from an objc.ID.

A class that describes the properties of a 3D-convolution operator.

func NewGraphConvolution3DOpDescriptorWithStrideInXStrideInYStrideInZDilationRateInXDilationRateInYDilationRateInZGroupsPaddingLeftPaddingRightPaddingTopPaddingBottomPaddingFrontPaddingBackPaddingStyleDataLayoutWeightsLayout

func NewGraphConvolution3DOpDescriptorWithStrideInXStrideInYStrideInZDilationRateInXDilationRateInYDilationRateInZGroupsPaddingLeftPaddingRightPaddingTopPaddingBottomPaddingFrontPaddingBackPaddingStyleDataLayoutWeightsLayout(strideInX uint, strideInY uint, strideInZ uint, dilationRateInX uint, dilationRateInY uint, dilationRateInZ uint, groups uint, paddingLeft uint, paddingRight uint, paddingTop uint, paddingBottom uint, paddingFront uint, paddingBack uint, paddingStyle MPSGraphPaddingStyle, dataLayout MPSGraphTensorNamedDataLayout, weightsLayout MPSGraphTensorNamedDataLayout) MPSGraphConvolution3DOpDescriptor

Creates a convolution descriptor with given values for parameters.

strideInX: See MPSGraphConvolution3DOpDescriptor.StrideInX property.

strideInY: See MPSGraphConvolution3DOpDescriptor.StrideInY property.

strideInZ: See MPSGraphConvolution3DOpDescriptor.StrideInZ property.

dilationRateInX: See MPSGraphConvolution3DOpDescriptor.DilationRateInX property.

dilationRateInY: See MPSGraphConvolution3DOpDescriptor.DilationRateInY property.

dilationRateInZ: See MPSGraphConvolution3DOpDescriptor.DilationRateInZ property.

groups: See MPSGraphConvolution3DOpDescriptor.Groups property.

paddingLeft: See MPSGraphConvolution3DOpDescriptor.PaddingLeft property.

paddingRight: See MPSGraphConvolution3DOpDescriptor.PaddingRight property.

paddingTop: See MPSGraphConvolution3DOpDescriptor.PaddingTop property.

paddingBottom: See MPSGraphConvolution3DOpDescriptor.PaddingBottom property.

paddingFront: See MPSGraphConvolution3DOpDescriptor.PaddingFront property.

paddingBack: See MPSGraphConvolution3DOpDescriptor.PaddingBack property.

paddingStyle: See MPSGraphConvolution3DOpDescriptor.PaddingStyle property.

dataLayout: See MPSGraphConvolution3DOpDescriptor.DataLayout property.

weightsLayout: See MPSGraphConvolution3DOpDescriptor.WeightsLayout property.

Return Value

The MPSGraphConvolution3DOpDescriptor on autoreleasepool.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution3DOpDescriptor/init(strideInX:strideInY:strideInZ:dilationRateInX:dilationRateInY:dilationRateInZ:groups:paddingLeft:paddingRight:paddingTop:paddingBottom:paddingFront:paddingBack:paddingStyle:dataLayout:weightsLayout:)

func NewGraphConvolution3DOpDescriptorWithStrideInXStrideInYStrideInZDilationRateInXDilationRateInYDilationRateInZGroupsPaddingStyleDataLayoutWeightsLayout

func NewGraphConvolution3DOpDescriptorWithStrideInXStrideInYStrideInZDilationRateInXDilationRateInYDilationRateInZGroupsPaddingStyleDataLayoutWeightsLayout(strideInX uint, strideInY uint, strideInZ uint, dilationRateInX uint, dilationRateInY uint, dilationRateInZ uint, groups uint, paddingStyle MPSGraphPaddingStyle, dataLayout MPSGraphTensorNamedDataLayout, weightsLayout MPSGraphTensorNamedDataLayout) MPSGraphConvolution3DOpDescriptor

Creates a convolution descriptor with given values for parameters.

strideInX: See MPSGraphConvolution3DOpDescriptor.StrideInX property.

strideInY: See MPSGraphConvolution3DOpDescriptor.StrideInY property.

strideInZ: See MPSGraphConvolution3DOpDescriptor.StrideInZ property.

dilationRateInX: See MPSGraphConvolution3DOpDescriptor.DilationRateInX property.

dilationRateInY: See MPSGraphConvolution3DOpDescriptor.DilationRateInY property.

dilationRateInZ: See MPSGraphConvolution3DOpDescriptor.DilationRateInZ property.

groups: See MPSGraphConvolution3DOpDescriptor.Groups property.

paddingStyle: See MPSGraphConvolution3DOpDescriptor.PaddingStyle property.

dataLayout: See MPSGraphConvolution3DOpDescriptor.DataLayout property.

weightsLayout: See MPSGraphConvolution3DOpDescriptor.WeightsLayout property.

Return Value

The MPSGraphConvolution3DOpDescriptor on autoreleasepool.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution3DOpDescriptor/init(strideInX:strideInY:strideInZ:dilationRateInX:dilationRateInY:dilationRateInZ:groups:paddingStyle:dataLayout:weightsLayout:)

func NewMPSGraphConvolution3DOpDescriptor

func NewMPSGraphConvolution3DOpDescriptor() MPSGraphConvolution3DOpDescriptor

NewMPSGraphConvolution3DOpDescriptor creates a new MPSGraphConvolution3DOpDescriptor instance.

func (MPSGraphConvolution3DOpDescriptor) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphConvolution3DOpDescriptor) DataLayout

The named layout of data in the source tensor.

Discussion

It defines the order of named dimensions (Batch, Channel, Depth, Height, Width). The convolution operation uses this to interpret data in the source tensor. For example, if `dataLayout` is MPSGraphTensorNamedDataLayoutNCDHW, frameork interprets data in source tensor as `batch x channels x depth x height x width` with `width` as fastest moving dimension.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution3DOpDescriptor/dataLayout

func (MPSGraphConvolution3DOpDescriptor) DilationRateInX

func (g MPSGraphConvolution3DOpDescriptor) DilationRateInX() uint

The amount by which weights tensor expands in the `x`-direction.

Discussion

The weights tensor is dilated by inserting `dilationRateInX-1` zeros between consecutive values in `x`-dimension. Dilated weights tensor width is `(dilationRateInX-1)*kernelWidth+1`. Default value is 1.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution3DOpDescriptor/dilationRateInX

func (MPSGraphConvolution3DOpDescriptor) DilationRateInY

func (g MPSGraphConvolution3DOpDescriptor) DilationRateInY() uint

The amount by which weights tensor expands in the `y`-direction.

Discussion

The weights tensor is dilated by inserting `dilationRateInY-1` zeros between consecutive values in `y`-dimension. Dilated weights tensor width is `(dilationRateInY-1)*kernelHeight+1`. Default value is 1.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution3DOpDescriptor/dilationRateInY

func (MPSGraphConvolution3DOpDescriptor) DilationRateInZ

func (g MPSGraphConvolution3DOpDescriptor) DilationRateInZ() uint

The amount by which weights tensor expands in the `z`-direction.

Discussion

The weights tensor is dilated by inserting `dilationRateInZ-1` zeros between consecutive values in `z`-dimension. Dilated weights tensor depth is `(dilationRateInZ-1)*kernelDepth+1`. Default value is 1.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution3DOpDescriptor/dilationRateInZ

func (MPSGraphConvolution3DOpDescriptor) Groups

The number of partitions of the input and output channels.

Discussion

The convolution operation divides input and output channels in `groups` partitions. input channels in a group or partition are only connected to output channels in corresponding group. Number of weights the convolution needs is `outputFeatureChannels x inputFeatureChannels/groups x kernelDepth x kernelWidth x kernelHeight`

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution3DOpDescriptor/groups

func (MPSGraphConvolution3DOpDescriptor) Init

Init initializes the instance.

func (MPSGraphConvolution3DOpDescriptor) PaddingBack

func (g MPSGraphConvolution3DOpDescriptor) PaddingBack() uint

The number of zeros added at the back of the source tensor.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution3DOpDescriptor/paddingBack

func (MPSGraphConvolution3DOpDescriptor) PaddingBottom

func (g MPSGraphConvolution3DOpDescriptor) PaddingBottom() uint

The number of zeros added at the bottom of the source tensor.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution3DOpDescriptor/paddingBottom

func (MPSGraphConvolution3DOpDescriptor) PaddingFront

func (g MPSGraphConvolution3DOpDescriptor) PaddingFront() uint

The number of zeros added at the front of the source tensor.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution3DOpDescriptor/paddingFront

func (MPSGraphConvolution3DOpDescriptor) PaddingLeft

func (g MPSGraphConvolution3DOpDescriptor) PaddingLeft() uint

The number of zeros added on the left side of the source tensor.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution3DOpDescriptor/paddingLeft

func (MPSGraphConvolution3DOpDescriptor) PaddingRight

func (g MPSGraphConvolution3DOpDescriptor) PaddingRight() uint

The number of zeros added on the right side of the source tensor.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution3DOpDescriptor/paddingRight

func (MPSGraphConvolution3DOpDescriptor) PaddingStyle

The type of padding that is applied to the source tensor.

Discussion

If paddingStyle is MPSGraphPaddingStyleExplicit, `paddingLeft`, `laddingRight`, `paddingTop`, `paddingBottom`, `paddingFront` and `paddingBack` must to be specified. For all other padding styles, framework compute these values so you dont need to provide these values.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution3DOpDescriptor/paddingStyle

func (MPSGraphConvolution3DOpDescriptor) PaddingTop

func (g MPSGraphConvolution3DOpDescriptor) PaddingTop() uint

The number of zeros added at the top of the source tensor.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution3DOpDescriptor/paddingTop

func (MPSGraphConvolution3DOpDescriptor) SetDataLayout

func (MPSGraphConvolution3DOpDescriptor) SetDilationRateInX

func (g MPSGraphConvolution3DOpDescriptor) SetDilationRateInX(value uint)

func (MPSGraphConvolution3DOpDescriptor) SetDilationRateInY

func (g MPSGraphConvolution3DOpDescriptor) SetDilationRateInY(value uint)

func (MPSGraphConvolution3DOpDescriptor) SetDilationRateInZ

func (g MPSGraphConvolution3DOpDescriptor) SetDilationRateInZ(value uint)

func (MPSGraphConvolution3DOpDescriptor) SetExplicitPaddingWithPaddingLeftPaddingRightPaddingTopPaddingBottomPaddingFrontPaddingBack

func (g MPSGraphConvolution3DOpDescriptor) SetExplicitPaddingWithPaddingLeftPaddingRightPaddingTopPaddingBottomPaddingFrontPaddingBack(paddingLeft uint, paddingRight uint, paddingTop uint, paddingBottom uint, paddingFront uint, paddingBack uint)

Sets the left, right, top, bottom, front, and back padding values.

paddingLeft: See MPSGraphConvolution3DOpDescriptor.PaddingLeft property.

paddingRight: See MPSGraphConvolution3DOpDescriptor.PaddingRight property.

paddingTop: See MPSGraphConvolution3DOpDescriptor.PaddingTop property.

paddingBottom: See MPSGraphConvolution3DOpDescriptor.PaddingBottom property.

paddingFront: See MPSGraphConvolution3DOpDescriptor.PaddingFront property.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution3DOpDescriptor/setExplicitPaddingWithPaddingLeft(_:paddingRight:paddingTop:paddingBottom:paddingFront:paddingBack:)

func (MPSGraphConvolution3DOpDescriptor) SetGroups

func (g MPSGraphConvolution3DOpDescriptor) SetGroups(value uint)

func (MPSGraphConvolution3DOpDescriptor) SetPaddingBack

func (g MPSGraphConvolution3DOpDescriptor) SetPaddingBack(value uint)

func (MPSGraphConvolution3DOpDescriptor) SetPaddingBottom

func (g MPSGraphConvolution3DOpDescriptor) SetPaddingBottom(value uint)

func (MPSGraphConvolution3DOpDescriptor) SetPaddingFront

func (g MPSGraphConvolution3DOpDescriptor) SetPaddingFront(value uint)

func (MPSGraphConvolution3DOpDescriptor) SetPaddingLeft

func (g MPSGraphConvolution3DOpDescriptor) SetPaddingLeft(value uint)

func (MPSGraphConvolution3DOpDescriptor) SetPaddingRight

func (g MPSGraphConvolution3DOpDescriptor) SetPaddingRight(value uint)

func (MPSGraphConvolution3DOpDescriptor) SetPaddingStyle

func (MPSGraphConvolution3DOpDescriptor) SetPaddingTop

func (g MPSGraphConvolution3DOpDescriptor) SetPaddingTop(value uint)

func (MPSGraphConvolution3DOpDescriptor) SetStrideInX

func (g MPSGraphConvolution3DOpDescriptor) SetStrideInX(value uint)

func (MPSGraphConvolution3DOpDescriptor) SetStrideInY

func (g MPSGraphConvolution3DOpDescriptor) SetStrideInY(value uint)

func (MPSGraphConvolution3DOpDescriptor) SetStrideInZ

func (g MPSGraphConvolution3DOpDescriptor) SetStrideInZ(value uint)

func (MPSGraphConvolution3DOpDescriptor) SetWeightsLayout

func (MPSGraphConvolution3DOpDescriptor) StrideInX

The scale that maps`x`-coordinate of destination to `x`-coordinate of source.

Discussion

Source `x`-coordinate, `sx` is computed from destination `x`-coordinate, `dx` as `sx = strideInX*dx`. Default value is 1.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution3DOpDescriptor/strideInX

func (MPSGraphConvolution3DOpDescriptor) StrideInY

The scale that maps`y`-coordinate of destination to `y`-coordinate of source.

Discussion

Source `y`-coordinate, `sy` is computed from destination `y`-coordinate, `dy` as `sy = strideInY*dy`. Default value is 1.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution3DOpDescriptor/strideInY

func (MPSGraphConvolution3DOpDescriptor) StrideInZ

The scale that maps`z`-coordinate of destination to `z`-coordinate of source.

Discussion

Source `z`-coordinate, `sz` is computed from destination `z`-coordinate, `dz` as `sz = strideInZ*dz`. Default value is 1.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution3DOpDescriptor/strideInZ

func (MPSGraphConvolution3DOpDescriptor) WeightsLayout

The named layout of data in the weights tensor.

Discussion

It defines the order of named dimensions (Output channels, Input channels, Kernel depth, Kernel height, Kernel width). The convolution operation uses this to interpret data in the weights tensor. For example, if `weightsLayout` is MPSGraphTensorNamedDataLayoutOIDHW, frameork interprets data in weights tensor as `outputChannels x inputChannels x kernelDepth x kernelHeight x kernelWidth` with `kernelWidth` as fastest moving dimension.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphConvolution3DOpDescriptor/weightsLayout

type MPSGraphConvolution3DOpDescriptorClass

type MPSGraphConvolution3DOpDescriptorClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphConvolution3DOpDescriptorClass

func GetMPSGraphConvolution3DOpDescriptorClass() MPSGraphConvolution3DOpDescriptorClass

GetMPSGraphConvolution3DOpDescriptorClass returns the class object for MPSGraphConvolution3DOpDescriptor.

func (MPSGraphConvolution3DOpDescriptorClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphConvolution3DOpDescriptorClass) Class

Class returns the underlying Objective-C class pointer.

type MPSGraphCreateSparseOpDescriptor

type MPSGraphCreateSparseOpDescriptor struct {
	MPSGraphObject
}

A class that describes the properties of a create sparse operation.

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphCreateSparseOpDescriptor

func MPSGraphCreateSparseOpDescriptorFromID

func MPSGraphCreateSparseOpDescriptorFromID(id objc.ID) MPSGraphCreateSparseOpDescriptor

MPSGraphCreateSparseOpDescriptorFromID constructs a MPSGraphCreateSparseOpDescriptor from an objc.ID.

A class that describes the properties of a create sparse operation.

func NewMPSGraphCreateSparseOpDescriptor

func NewMPSGraphCreateSparseOpDescriptor() MPSGraphCreateSparseOpDescriptor

NewMPSGraphCreateSparseOpDescriptor creates a new MPSGraphCreateSparseOpDescriptor instance.

func (MPSGraphCreateSparseOpDescriptor) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphCreateSparseOpDescriptor) DataType

Defines the datatype of the sparse tensor.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphCreateSparseOpDescriptor/dataType

func (MPSGraphCreateSparseOpDescriptor) Init

Init initializes the instance.

func (MPSGraphCreateSparseOpDescriptor) SetDataType

func (g MPSGraphCreateSparseOpDescriptor) SetDataType(value uint32)

func (MPSGraphCreateSparseOpDescriptor) SetSparseStorageType

func (g MPSGraphCreateSparseOpDescriptor) SetSparseStorageType(value MPSGraphSparseStorageType)

type MPSGraphCreateSparseOpDescriptorClass

type MPSGraphCreateSparseOpDescriptorClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphCreateSparseOpDescriptorClass

func GetMPSGraphCreateSparseOpDescriptorClass() MPSGraphCreateSparseOpDescriptorClass

GetMPSGraphCreateSparseOpDescriptorClass returns the class object for MPSGraphCreateSparseOpDescriptor.

func (MPSGraphCreateSparseOpDescriptorClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphCreateSparseOpDescriptorClass) Class

Class returns the underlying Objective-C class pointer.

func (MPSGraphCreateSparseOpDescriptorClass) DescriptorWithStorageTypeDataType

func (_MPSGraphCreateSparseOpDescriptorClass MPSGraphCreateSparseOpDescriptorClass) DescriptorWithStorageTypeDataType(sparseStorageType MPSGraphSparseStorageType, dataType uint32) MPSGraphCreateSparseOpDescriptor

Creates a descriptor for a sparse tensor.

sparseStorageType: A sparseStorageType.

dataType: A dataType of the sparse tensor.

Return Value

The descriptor.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphCreateSparseOpDescriptor/sparseDescriptor(descriptorWithStorageType:dataType:)

type MPSGraphDeploymentPlatform

type MPSGraphDeploymentPlatform uint64

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDeploymentPlatform

const (
	// MPSGraphDeploymentPlatformIOS: Deployment target for iOS.
	MPSGraphDeploymentPlatformIOS MPSGraphDeploymentPlatform = 1
	// MPSGraphDeploymentPlatformMacOS: Deployment platofmr for macOS.
	MPSGraphDeploymentPlatformMacOS MPSGraphDeploymentPlatform = 0
	// MPSGraphDeploymentPlatformTvOS: Deployment target for tvOS.
	MPSGraphDeploymentPlatformTvOS MPSGraphDeploymentPlatform = 2
	// MPSGraphDeploymentPlatformVisionOS: Deployment target for visionOS.
	MPSGraphDeploymentPlatformVisionOS MPSGraphDeploymentPlatform = 3
)

func (MPSGraphDeploymentPlatform) String

type MPSGraphDepthwiseConvolution2DOpDescriptor

type MPSGraphDepthwiseConvolution2DOpDescriptor struct {
	MPSGraphObject
}

A class that defines the parameters for a 2D-depthwise convolution operation.

Overview

An MPSGraphDepthwiseConvolution2DOpDescriptor defines constant parameters for 2D-depthwise convolutions. Use this class with MPSGraph.DepthwiseConvolution2DWithSourceTensorWeightsTensorDescriptorName, MPSGraph.DepthwiseConvolution2DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeDescriptorName, and MPSGraph.DepthwiseConvolution2DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeDescriptorName methods.

Instance Properties

Instance Methods

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDepthwiseConvolution2DOpDescriptor

func MPSGraphDepthwiseConvolution2DOpDescriptorFromID

func MPSGraphDepthwiseConvolution2DOpDescriptorFromID(id objc.ID) MPSGraphDepthwiseConvolution2DOpDescriptor

MPSGraphDepthwiseConvolution2DOpDescriptorFromID constructs a MPSGraphDepthwiseConvolution2DOpDescriptor from an objc.ID.

A class that defines the parameters for a 2D-depthwise convolution operation.

func NewGraphDepthwiseConvolution2DOpDescriptorWithDataLayoutWeightsLayout

func NewGraphDepthwiseConvolution2DOpDescriptorWithDataLayoutWeightsLayout(dataLayout MPSGraphTensorNamedDataLayout, weightsLayout MPSGraphTensorNamedDataLayout) MPSGraphDepthwiseConvolution2DOpDescriptor

Creates a 2D-depthwise convolution descriptor with given properties and default values.

dataLayout: See `dataLayout` property.

weightsLayout: See `weightsLayout` property.

Return Value

The descriptor on autoreleasepool.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDepthwiseConvolution2DOpDescriptor/init(dataLayout:weightsLayout:)

func NewGraphDepthwiseConvolution2DOpDescriptorWithStrideInXStrideInYDilationRateInXDilationRateInYPaddingLeftPaddingRightPaddingTopPaddingBottomPaddingStyleDataLayoutWeightsLayout

func NewGraphDepthwiseConvolution2DOpDescriptorWithStrideInXStrideInYDilationRateInXDilationRateInYPaddingLeftPaddingRightPaddingTopPaddingBottomPaddingStyleDataLayoutWeightsLayout(strideInX uint, strideInY uint, dilationRateInX uint, dilationRateInY uint, paddingLeft uint, paddingRight uint, paddingTop uint, paddingBottom uint, paddingStyle MPSGraphPaddingStyle, dataLayout MPSGraphTensorNamedDataLayout, weightsLayout MPSGraphTensorNamedDataLayout) MPSGraphDepthwiseConvolution2DOpDescriptor

Creates a 2D-depthwise convolution descriptor with given values.

strideInX: See `strideInX` property.

strideInY: See `strideInY` property.

dilationRateInX: See `dilationRateInX` property.

dilationRateInY: See `dilationRateInY` property.

paddingLeft: See `paddingLeft` property.

paddingRight: See `paddingRight` property.

paddingTop: See `paddingTop` property.

paddingBottom: See `paddingBottom` property.

paddingStyle: See `paddingStyle` property.

dataLayout: See `dataLayout` property.

weightsLayout: See `weightsLayout` property.

Return Value

The descriptor on autoreleasepool.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDepthwiseConvolution2DOpDescriptor/init(strideInX:strideInY:dilationRateInX:dilationRateInY:paddingLeft:paddingRight:paddingTop:paddingBottom:paddingStyle:dataLayout:weightsLayout:)

func NewMPSGraphDepthwiseConvolution2DOpDescriptor

func NewMPSGraphDepthwiseConvolution2DOpDescriptor() MPSGraphDepthwiseConvolution2DOpDescriptor

NewMPSGraphDepthwiseConvolution2DOpDescriptor creates a new MPSGraphDepthwiseConvolution2DOpDescriptor instance.

func (MPSGraphDepthwiseConvolution2DOpDescriptor) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphDepthwiseConvolution2DOpDescriptor) DilationRateInX

The dilation rate for the x dimension.

Discussion

Default value: 1.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDepthwiseConvolution2DOpDescriptor/dilationRateInX

func (MPSGraphDepthwiseConvolution2DOpDescriptor) DilationRateInY

The dilation rate for the y dimension.

Discussion

Default value: 1.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDepthwiseConvolution2DOpDescriptor/dilationRateInY

func (MPSGraphDepthwiseConvolution2DOpDescriptor) Init

Init initializes the instance.

func (MPSGraphDepthwiseConvolution2DOpDescriptor) PaddingBottom

The explicit padding value for the y dimension operation adds after the data.

Discussion

Default value: 0.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDepthwiseConvolution2DOpDescriptor/paddingBottom

func (MPSGraphDepthwiseConvolution2DOpDescriptor) PaddingLeft

The explicit padding value for the x dimension the operation adds before the data.

Discussion

Default value: 0.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDepthwiseConvolution2DOpDescriptor/paddingLeft

func (MPSGraphDepthwiseConvolution2DOpDescriptor) PaddingRight

The explicit padding value for the x dimension operation adds after the data.

Discussion

Default value: 0.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDepthwiseConvolution2DOpDescriptor/paddingRight

func (MPSGraphDepthwiseConvolution2DOpDescriptor) PaddingTop

The explicit padding value for the y dimension operation adds before the data.

Discussion

Default value: 0.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDepthwiseConvolution2DOpDescriptor/paddingTop

func (MPSGraphDepthwiseConvolution2DOpDescriptor) SetDataLayout

func (MPSGraphDepthwiseConvolution2DOpDescriptor) SetDilationRateInX

func (g MPSGraphDepthwiseConvolution2DOpDescriptor) SetDilationRateInX(value uint)

func (MPSGraphDepthwiseConvolution2DOpDescriptor) SetDilationRateInY

func (g MPSGraphDepthwiseConvolution2DOpDescriptor) SetDilationRateInY(value uint)

func (MPSGraphDepthwiseConvolution2DOpDescriptor) SetExplicitPaddingWithPaddingLeftPaddingRightPaddingTopPaddingBottom

func (g MPSGraphDepthwiseConvolution2DOpDescriptor) SetExplicitPaddingWithPaddingLeftPaddingRightPaddingTopPaddingBottom(paddingLeft uint, paddingRight uint, paddingTop uint, paddingBottom uint)

Sets the explicit padding values.

paddingLeft: See `paddingLeft` property.

paddingRight: See `paddingRight` property.

paddingTop: See `paddingTop` property.

paddingBottom: See `paddingBottom` property.

Discussion

Note: this method also sets `paddingStyle` to MPSGraphPaddingStyleExplicit (see MPSGraphPaddingStyle).

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDepthwiseConvolution2DOpDescriptor/setExplicitPaddingWithPaddingLeft(_:paddingRight:paddingTop:paddingBottom:)

func (MPSGraphDepthwiseConvolution2DOpDescriptor) SetPaddingBottom

func (g MPSGraphDepthwiseConvolution2DOpDescriptor) SetPaddingBottom(value uint)

func (MPSGraphDepthwiseConvolution2DOpDescriptor) SetPaddingLeft

func (g MPSGraphDepthwiseConvolution2DOpDescriptor) SetPaddingLeft(value uint)

func (MPSGraphDepthwiseConvolution2DOpDescriptor) SetPaddingRight

func (g MPSGraphDepthwiseConvolution2DOpDescriptor) SetPaddingRight(value uint)

func (MPSGraphDepthwiseConvolution2DOpDescriptor) SetPaddingStyle

func (MPSGraphDepthwiseConvolution2DOpDescriptor) SetPaddingTop

func (g MPSGraphDepthwiseConvolution2DOpDescriptor) SetPaddingTop(value uint)

func (MPSGraphDepthwiseConvolution2DOpDescriptor) SetStrideInX

func (g MPSGraphDepthwiseConvolution2DOpDescriptor) SetStrideInX(value uint)

func (MPSGraphDepthwiseConvolution2DOpDescriptor) SetStrideInY

func (g MPSGraphDepthwiseConvolution2DOpDescriptor) SetStrideInY(value uint)

func (MPSGraphDepthwiseConvolution2DOpDescriptor) SetWeightsLayout

func (MPSGraphDepthwiseConvolution2DOpDescriptor) StrideInX

The stride for the x dimension.

Discussion

Default value: 1.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDepthwiseConvolution2DOpDescriptor/strideInX

func (MPSGraphDepthwiseConvolution2DOpDescriptor) StrideInY

The stride for the y dimension.

Discussion

Default value: 1.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDepthwiseConvolution2DOpDescriptor/strideInY

func (MPSGraphDepthwiseConvolution2DOpDescriptor) WeightsLayout

The data layout of the weights.

Discussion

NOTE: ‘O’ index is channel multiplier index. See: MPSGraphTensorNamedDataLayout.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDepthwiseConvolution2DOpDescriptor/weightsLayout

type MPSGraphDepthwiseConvolution2DOpDescriptorClass

type MPSGraphDepthwiseConvolution2DOpDescriptorClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphDepthwiseConvolution2DOpDescriptorClass

func GetMPSGraphDepthwiseConvolution2DOpDescriptorClass() MPSGraphDepthwiseConvolution2DOpDescriptorClass

GetMPSGraphDepthwiseConvolution2DOpDescriptorClass returns the class object for MPSGraphDepthwiseConvolution2DOpDescriptor.

func (MPSGraphDepthwiseConvolution2DOpDescriptorClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphDepthwiseConvolution2DOpDescriptorClass) Class

Class returns the underlying Objective-C class pointer.

type MPSGraphDepthwiseConvolution3DOpDescriptor

type MPSGraphDepthwiseConvolution3DOpDescriptor struct {
	MPSGraphObject
}

The class that defines the parameters for a 3D-depthwise convolution operation.

Overview

A MPSGraphDepthwiseConvolution3DOpDescriptor defines constant parameters for 3D depthwise convolutions. Use this class with MPSGraph.DepthwiseConvolution3DWithSourceTensorWeightsTensorDescriptorName, MPSGraph.DepthwiseConvolution3DDataGradientWithIncomingGradientTensorWeightsTensorOutputShapeDescriptorName and MPSGraph.DepthwiseConvolution3DWeightsGradientWithIncomingGradientTensorSourceTensorOutputShapeDescriptorName methods.

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDepthwiseConvolution3DOpDescriptor

func MPSGraphDepthwiseConvolution3DOpDescriptorFromID

func MPSGraphDepthwiseConvolution3DOpDescriptorFromID(id objc.ID) MPSGraphDepthwiseConvolution3DOpDescriptor

MPSGraphDepthwiseConvolution3DOpDescriptorFromID constructs a MPSGraphDepthwiseConvolution3DOpDescriptor from an objc.ID.

The class that defines the parameters for a 3D-depthwise convolution operation.

func NewGraphDepthwiseConvolution3DOpDescriptorWithPaddingStyle

func NewGraphDepthwiseConvolution3DOpDescriptorWithPaddingStyle(paddingStyle MPSGraphPaddingStyle) MPSGraphDepthwiseConvolution3DOpDescriptor

Creates a 3D depthwise convolution descriptor with default values.

paddingStyle: See `paddingStyle` property.

Return Value

The descriptor on autoreleasepool.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDepthwiseConvolution3DOpDescriptor/init(paddingStyle:)

func NewGraphDepthwiseConvolution3DOpDescriptorWithStridesDilationRatesPaddingValuesPaddingStyle

func NewGraphDepthwiseConvolution3DOpDescriptorWithStridesDilationRatesPaddingValuesPaddingStyle(strides []foundation.NSNumber, dilationRates []foundation.NSNumber, paddingValues []foundation.NSNumber, paddingStyle MPSGraphPaddingStyle) MPSGraphDepthwiseConvolution3DOpDescriptor

Creates a 3D depthwise convolution descriptor with given values.

strides: See `strides` property.

dilationRates: See `dilationRates` property.

paddingValues: See `paddingValues` property.

paddingStyle: See `paddingStyle` property.

Return Value

The descriptor on autoreleasepool.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDepthwiseConvolution3DOpDescriptor/init(strides:dilationRates:paddingValues:paddingStyle:)

func NewMPSGraphDepthwiseConvolution3DOpDescriptor

func NewMPSGraphDepthwiseConvolution3DOpDescriptor() MPSGraphDepthwiseConvolution3DOpDescriptor

NewMPSGraphDepthwiseConvolution3DOpDescriptor creates a new MPSGraphDepthwiseConvolution3DOpDescriptor instance.

func (MPSGraphDepthwiseConvolution3DOpDescriptor) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphDepthwiseConvolution3DOpDescriptor) ChannelDimensionIndex

func (g MPSGraphDepthwiseConvolution3DOpDescriptor) ChannelDimensionIndex() int

The axis that contains the channels in the input and the weights, within the 4D tile of the last dimensions.

Discussion

For example the value of `-1` corresponds to [NDHWC], [NHWC] layouts. This allows the placement of the channel index anywhere within the last 4 dimensions of the tensor. In case your weights are in a different layout you can bring them to the same layout as inputs using transposes or permutations. Default value: `-4`, corresponds to [NCDHW] and [CDHW] layouts.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDepthwiseConvolution3DOpDescriptor/channelDimensionIndex

func (MPSGraphDepthwiseConvolution3DOpDescriptor) DilationRates

The dilation rates for spatial dimensions.

Discussion

Must be three numbers, one for each spatial dimension, fastest running index last. Default value: `@[ @1, @1, @1 ]`

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDepthwiseConvolution3DOpDescriptor/dilationRates

func (MPSGraphDepthwiseConvolution3DOpDescriptor) Init

Init initializes the instance.

func (MPSGraphDepthwiseConvolution3DOpDescriptor) PaddingValues

The padding values for spatial dimensions.

Discussion

Must be six numbers, two for each spatial dimension. For example `paddingValues[0]` defines the explicit padding amount before the first spatial dimension (slowest running index of spatial dimensions), `paddingValues[1]` defines the padding amount after the first spatial dimension etc. Use only with `paddingStyle = MPSGraphPaddingStyleExplicit`. Default value: `@[ @0, @0, @0, @0, @0, @0 ]`

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDepthwiseConvolution3DOpDescriptor/paddingValues

func (MPSGraphDepthwiseConvolution3DOpDescriptor) SetChannelDimensionIndex

func (g MPSGraphDepthwiseConvolution3DOpDescriptor) SetChannelDimensionIndex(value int)

func (MPSGraphDepthwiseConvolution3DOpDescriptor) SetDilationRates

func (MPSGraphDepthwiseConvolution3DOpDescriptor) SetPaddingStyle

func (MPSGraphDepthwiseConvolution3DOpDescriptor) SetPaddingValues

func (MPSGraphDepthwiseConvolution3DOpDescriptor) SetStrides

func (MPSGraphDepthwiseConvolution3DOpDescriptor) Strides

The strides for spatial dimensions.

Discussion

Must be three numbers, one for each spatial dimension, fastest running index last. Default value: `@[ @1, @1, @1 ]`

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDepthwiseConvolution3DOpDescriptor/strides

type MPSGraphDepthwiseConvolution3DOpDescriptorClass

type MPSGraphDepthwiseConvolution3DOpDescriptorClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphDepthwiseConvolution3DOpDescriptorClass

func GetMPSGraphDepthwiseConvolution3DOpDescriptorClass() MPSGraphDepthwiseConvolution3DOpDescriptorClass

GetMPSGraphDepthwiseConvolution3DOpDescriptorClass returns the class object for MPSGraphDepthwiseConvolution3DOpDescriptor.

func (MPSGraphDepthwiseConvolution3DOpDescriptorClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphDepthwiseConvolution3DOpDescriptorClass) Class

Class returns the underlying Objective-C class pointer.

type MPSGraphDevice

type MPSGraphDevice struct {
	MPSGraphObject
}

A class that describes the compute device.

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDevice

func MPSGraphDeviceFromID

func MPSGraphDeviceFromID(id objc.ID) MPSGraphDevice

MPSGraphDeviceFromID constructs a MPSGraphDevice from an objc.ID.

A class that describes the compute device.

func NewGraphDeviceWithMTLDevice

func NewGraphDeviceWithMTLDevice(metalDevice metal.MTLDevice) MPSGraphDevice

Creates a device from a given Metal device.

metalDevice: [MTLDevice] to create an MPSGraphDevice from.

Return Value

A valid device.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDevice/init(mtlDevice:)

func NewMPSGraphDevice

func NewMPSGraphDevice() MPSGraphDevice

NewMPSGraphDevice creates a new MPSGraphDevice instance.

func (MPSGraphDevice) Autorelease

func (g MPSGraphDevice) Autorelease() MPSGraphDevice

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphDevice) Init

func (g MPSGraphDevice) Init() MPSGraphDevice

Init initializes the instance.

func (MPSGraphDevice) MetalDevice

func (g MPSGraphDevice) MetalDevice() metal.MTLDevice

If device type is Metal then returns the corresponding MTLDevice else nil.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDevice/metalDevice

type MPSGraphDeviceClass

type MPSGraphDeviceClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphDeviceClass

func GetMPSGraphDeviceClass() MPSGraphDeviceClass

GetMPSGraphDeviceClass returns the class object for MPSGraphDevice.

func (MPSGraphDeviceClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphDeviceClass) Class

func (mc MPSGraphDeviceClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type MPSGraphDeviceType

type MPSGraphDeviceType uint32

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphDeviceType

const (
	// MPSGraphDeviceTypeMetal: Device of type Metal
	MPSGraphDeviceTypeMetal MPSGraphDeviceType = 0
)

func (MPSGraphDeviceType) String

func (e MPSGraphDeviceType) String() string

type MPSGraphExecutable

type MPSGraphExecutable struct {
	MPSGraphObject
}

The compiled representation of a compute graph executable.

Overview

An MPSGraphExecutable is a compiled graph for specific feeds for specific target tensors and target operations.

Initializers

Instance Properties

Instance Methods

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutable

func MPSGraphExecutableFromID

func MPSGraphExecutableFromID(id objc.ID) MPSGraphExecutable

MPSGraphExecutableFromID constructs a MPSGraphExecutable from an objc.ID.

The compiled representation of a compute graph executable.

func NewGraphExecutableWithCoreMLPackageAtURLCompilationDescriptor

func NewGraphExecutableWithCoreMLPackageAtURLCompilationDescriptor(coreMLPackageURL foundation.NSURL, compilationDescriptor IMPSGraphCompilationDescriptor) MPSGraphExecutable

Initialize the executable with the Core ML model package at the provided URL.

coreMLPackageURL: The URL where to read the Core ML model package.

compilationDescriptor: Compilation descriptor to be used to specialize, since the executable was created with a compilationDescriptor already this one overrides those settings to the extent it can.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutable/init(coreMLPackageAtURL:descriptor:)

func NewGraphExecutableWithMPSGraphPackageAtURLCompilationDescriptor

func NewGraphExecutableWithMPSGraphPackageAtURLCompilationDescriptor(mpsgraphPackageURL foundation.NSURL, compilationDescriptor IMPSGraphCompilationDescriptor) MPSGraphExecutable

Initialize the executable with the Metal Performance Shaders Graph package at the provided URL.

mpsgraphPackageURL: The URL where to read the serialized MPSGraphExecutable.

compilationDescriptor: Compilation descriptor to be used to specialize, since the executable was created with a compilationDescriptor already this one overrides those settings to the extent it can.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutable/init(package:descriptor:)

func NewMPSGraphExecutable

func NewMPSGraphExecutable() MPSGraphExecutable

NewMPSGraphExecutable creates a new MPSGraphExecutable instance.

func (MPSGraphExecutable) Autorelease

func (g MPSGraphExecutable) Autorelease() MPSGraphExecutable

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphExecutable) EncodeToCommandBufferInputsArrayResultsArrayExecutionDescriptor

func (g MPSGraphExecutable) EncodeToCommandBufferInputsArrayResultsArrayExecutionDescriptor(commandBuffer *metalperformanceshaders.MPSCommandBuffer, inputsArray []MPSGraphTensorData, resultsArray []MPSGraphTensorData, executionDescriptor IMPSGraphExecutableExecutionDescriptor) []MPSGraphTensorData

Runs the graph for the given feeds and returns the target tensor values, ensuring all target operations also executed. This call is asynchronous and will return immediately after finishing encoding.

commandBuffer: CommandBuffer passed to exectute the graph on, commitAndContinue might be called, please don’t rely on underlying MTLCommandBuffer to remain uncommitted

inputsArray: Feeds tensorData for the placeholder tensors, same order as arguments of main function

resultsArray: Tensors for which the caller wishes MPSGraphTensorData to be returned

executionDescriptor: ExecutionDescriptor to be passed in and used,

Return Value

A valid MPSGraphTensorData array with results synchronized to the CPU memory if MPSGraphOptionsSynchronizeResults set.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutable/encode(to:inputs:results:executionDescriptor:)

func (MPSGraphExecutable) FeedTensors

func (g MPSGraphExecutable) FeedTensors() []MPSGraphTensor

Tensors fed to the graph, can be used to order the inputs when executable is created with a graph.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutable/feedTensors

func (MPSGraphExecutable) GetOutputTypesWithDeviceInputTypesCompilationDescriptor

func (g MPSGraphExecutable) GetOutputTypesWithDeviceInputTypesCompilationDescriptor(device IMPSGraphDevice, inputTypes []MPSGraphType, compilationDescriptor IMPSGraphCompilationDescriptor) []MPSGraphShapedType

Get output shapes for a specialized executable.

device: Optional MPSGraph device to compile with

inputTypes: Input types expected to be passed to the executable.

compilationDescriptor: CompilationDescriptor to be used to specialize, since the executable was created with a compilationDescriptor already this one overrides those settings to the extent it can.

Discussion

In case specialization has not been done yet then calling this function will specialize for the given input shapes.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutable/getOutputTypes(with:inputTypes:compilationDescriptor:)

func (MPSGraphExecutable) Init

Init initializes the instance.

func (MPSGraphExecutable) InitWithCoreMLPackageAtURLCompilationDescriptor

func (g MPSGraphExecutable) InitWithCoreMLPackageAtURLCompilationDescriptor(coreMLPackageURL foundation.NSURL, compilationDescriptor IMPSGraphCompilationDescriptor) MPSGraphExecutable

Initialize the executable with the Core ML model package at the provided URL.

coreMLPackageURL: The URL where to read the Core ML model package.

compilationDescriptor: Compilation descriptor to be used to specialize, since the executable was created with a compilationDescriptor already this one overrides those settings to the extent it can.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutable/init(coreMLPackageAtURL:descriptor:)

func (MPSGraphExecutable) InitWithMPSGraphPackageAtURLCompilationDescriptor

func (g MPSGraphExecutable) InitWithMPSGraphPackageAtURLCompilationDescriptor(mpsgraphPackageURL foundation.NSURL, compilationDescriptor IMPSGraphCompilationDescriptor) MPSGraphExecutable

Initialize the executable with the Metal Performance Shaders Graph package at the provided URL.

mpsgraphPackageURL: The URL where to read the serialized MPSGraphExecutable.

compilationDescriptor: Compilation descriptor to be used to specialize, since the executable was created with a compilationDescriptor already this one overrides those settings to the extent it can.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutable/init(package:descriptor:)

func (MPSGraphExecutable) Options

func (g MPSGraphExecutable) Options() MPSGraphOptions

Options for the graph executable.

Discussion

Default value is MPSGraphOptionsDefault.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutable/options

func (MPSGraphExecutable) RunAsyncWithMTLCommandQueueInputsArrayResultsArrayExecutionDescriptor

func (g MPSGraphExecutable) RunAsyncWithMTLCommandQueueInputsArrayResultsArrayExecutionDescriptor(commandQueue metal.MTLCommandQueue, inputsArray []MPSGraphTensorData, resultsArray []MPSGraphTensorData, executionDescriptor IMPSGraphExecutableExecutionDescriptor) []MPSGraphTensorData

Runs the graph for the given feeds and returns the target tensor values, ensuring all target operations also executed. This call is asynchronous and will return immediately.

commandQueue: CommandQueue passed to exectute the graph on.

inputsArray: Feeds tensorData for the placeholder tensors, same order as arguments of main function.

resultsArray: Tensors for which the caller wishes MPSGraphTensorData to be returned.

executionDescriptor: ExecutionDescriptor to be passed in and used.

Return Value

A valid MPSGraphTensorData array with results synchronized to the CPU memory if MPSGraphOptionsSynchronizeResults set.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutable/runAsync(with:inputs:results:executionDescriptor:)

func (MPSGraphExecutable) RunWithMTLCommandQueueInputsArrayResultsArrayExecutionDescriptor

func (g MPSGraphExecutable) RunWithMTLCommandQueueInputsArrayResultsArrayExecutionDescriptor(commandQueue metal.MTLCommandQueue, inputsArray []MPSGraphTensorData, resultsArray []MPSGraphTensorData, executionDescriptor IMPSGraphExecutableExecutionDescriptor) []MPSGraphTensorData

Runs the graph for the given feeds and returns the target tensor values, ensuring all target operations also executed.

commandQueue: CommandQueue passed to exectute the graph on.

inputsArray: Feeds tensorData for the placeholder tensors, same order as arguments of main function.

resultsArray: Results tensorData for which the caller wishes MPSGraphTensorData to be returned.

Return Value

A valid MPSGraphTensorData array with results synchronized to the CPU memory if MPSGraphOptionsSynchronizeResults set.

Discussion

This call is synchronous and will return on completion of execution.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutable/run(with:inputs:results:executionDescriptor:)

func (MPSGraphExecutable) SerializeToMPSGraphPackageAtURLDescriptor

func (g MPSGraphExecutable) SerializeToMPSGraphPackageAtURLDescriptor(url foundation.NSURL, descriptor IMPSGraphExecutableSerializationDescriptor)

Serialize the MPSGraph executable at the provided url.

url: The URL where to serialize the MPSGraph executable.

descriptor: The descriptor to be used to serialize the graph.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutable/serialize(package:descriptor:)

func (MPSGraphExecutable) SetOptions

func (g MPSGraphExecutable) SetOptions(value MPSGraphOptions)

func (MPSGraphExecutable) SpecializeWithDeviceInputTypesCompilationDescriptor

func (g MPSGraphExecutable) SpecializeWithDeviceInputTypesCompilationDescriptor(device IMPSGraphDevice, inputTypes []MPSGraphType, compilationDescriptor IMPSGraphCompilationDescriptor)

Specialize the executable and optimize it.

device: Ooptional MPSGraph device to compile with.

inputTypes: Input types expected to be passed to the executable.

compilationDescriptor: Compilation descriptor to be used to specialize, since the executable was created with a compilationDescriptor already this one overrides those settings to the extent it can.

Discussion

Use this method to choose when specialization happens, else it occurs at encode time automatically.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutable/specialize(with:inputTypes:compilationDescriptor:)

func (MPSGraphExecutable) TargetTensors

func (g MPSGraphExecutable) TargetTensors() []MPSGraphTensor

Tensors targeted by the graph, can be used to order the outputs when executable was created with a graph.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutable/targetTensors

type MPSGraphExecutableClass

type MPSGraphExecutableClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphExecutableClass

func GetMPSGraphExecutableClass() MPSGraphExecutableClass

GetMPSGraphExecutableClass returns the class object for MPSGraphExecutable.

func (MPSGraphExecutableClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphExecutableClass) Class

func (mc MPSGraphExecutableClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type MPSGraphExecutableCompletionHandler

type MPSGraphExecutableCompletionHandler = func(results []MPSGraphTensorData, error_ foundation.NSError)

MPSGraphExecutableCompletionHandler is a notification when graph executable execution finishes.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutableCompletionHandler

type MPSGraphExecutableErrorHandler

type MPSGraphExecutableErrorHandler = func(*MPSGraphExecutable, error)

MPSGraphExecutableErrorHandler is the signature for a completion handler block.

type MPSGraphExecutableExecutionDescriptor

type MPSGraphExecutableExecutionDescriptor struct {
	MPSGraphObject
}

A class that consists of all the levers to synchronize and schedule executable execution.

Instance Properties

Instance Methods

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutableExecutionDescriptor

func MPSGraphExecutableExecutionDescriptorFromID

func MPSGraphExecutableExecutionDescriptorFromID(id objc.ID) MPSGraphExecutableExecutionDescriptor

MPSGraphExecutableExecutionDescriptorFromID constructs a MPSGraphExecutableExecutionDescriptor from an objc.ID.

A class that consists of all the levers to synchronize and schedule executable execution.

func NewMPSGraphExecutableExecutionDescriptor

func NewMPSGraphExecutableExecutionDescriptor() MPSGraphExecutableExecutionDescriptor

NewMPSGraphExecutableExecutionDescriptor creates a new MPSGraphExecutableExecutionDescriptor instance.

func (MPSGraphExecutableExecutionDescriptor) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphExecutableExecutionDescriptor) CompletionHandler

A notification that appears when graph-executable execution is finished.

Discussion

Default value is nil.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutableExecutionDescriptor/completionHandler

func (MPSGraphExecutableExecutionDescriptor) Init

Init initializes the instance.

func (MPSGraphExecutableExecutionDescriptor) ScheduledHandler

A notification that appears when graph-executable execution is scheduled.

Discussion

Default value is nil.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutableExecutionDescriptor/scheduledHandler

func (MPSGraphExecutableExecutionDescriptor) SetCompletionHandler

func (MPSGraphExecutableExecutionDescriptor) SetScheduledHandler

func (MPSGraphExecutableExecutionDescriptor) SetWaitUntilCompleted

func (g MPSGraphExecutableExecutionDescriptor) SetWaitUntilCompleted(value bool)

func (MPSGraphExecutableExecutionDescriptor) SignalEventAtExecutionEventValue

func (g MPSGraphExecutableExecutionDescriptor) SignalEventAtExecutionEventValue(event metal.MTLSharedEvent, executionStage MPSGraphExecutionStage, value uint64)

Signals these shared events at execution stage and immediately proceeds.

event: Shared event to signal.

executionStage: Execution stage to signal event at.

value: Value for shared event to wait on.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutableExecutionDescriptor/signal(_:atExecutionEvent:value:)

func (MPSGraphExecutableExecutionDescriptor) WaitForEventValue

func (g MPSGraphExecutableExecutionDescriptor) WaitForEventValue(event metal.MTLSharedEvent, value uint64)

Waits on these shared events before scheduling execution on the HW.

event: Shared event to wait on.

value: Value for shared event to wait on.

Discussion

This does not include encoding which can still continue.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutableExecutionDescriptor/wait(for:value:)

func (MPSGraphExecutableExecutionDescriptor) WaitUntilCompleted

func (g MPSGraphExecutableExecutionDescriptor) WaitUntilCompleted() bool

Flag for the graph executable to wait till the execution has completed.

Discussion

Default value is false.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutableExecutionDescriptor/waitUntilCompleted

type MPSGraphExecutableExecutionDescriptorClass

type MPSGraphExecutableExecutionDescriptorClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphExecutableExecutionDescriptorClass

func GetMPSGraphExecutableExecutionDescriptorClass() MPSGraphExecutableExecutionDescriptorClass

GetMPSGraphExecutableExecutionDescriptorClass returns the class object for MPSGraphExecutableExecutionDescriptor.

func (MPSGraphExecutableExecutionDescriptorClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphExecutableExecutionDescriptorClass) Class

Class returns the underlying Objective-C class pointer.

type MPSGraphExecutableScheduledHandler

type MPSGraphExecutableScheduledHandler = func(results []MPSGraphTensorData, error_ foundation.NSError)

MPSGraphExecutableScheduledHandler is a notification when graph executable execution schedules.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutableScheduledHandler

type MPSGraphExecutableSerializationDescriptor

type MPSGraphExecutableSerializationDescriptor struct {
	MPSGraphObject
}

A class that consists of all the levers to serialize an executable.

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutableSerializationDescriptor

func MPSGraphExecutableSerializationDescriptorFromID

func MPSGraphExecutableSerializationDescriptorFromID(id objc.ID) MPSGraphExecutableSerializationDescriptor

MPSGraphExecutableSerializationDescriptorFromID constructs a MPSGraphExecutableSerializationDescriptor from an objc.ID.

A class that consists of all the levers to serialize an executable.

func NewMPSGraphExecutableSerializationDescriptor

func NewMPSGraphExecutableSerializationDescriptor() MPSGraphExecutableSerializationDescriptor

NewMPSGraphExecutableSerializationDescriptor creates a new MPSGraphExecutableSerializationDescriptor instance.

func (MPSGraphExecutableSerializationDescriptor) Append

Flag to append to an existing .mpsgraphpackage if found at provided url.

Discussion

If false, the exisiting .mpsgraphpackage will be overwritten.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutableSerializationDescriptor/append

func (MPSGraphExecutableSerializationDescriptor) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphExecutableSerializationDescriptor) DeploymentPlatform

The deployment platform used to serialize the executable.

Discussion

Defaults to the current platform.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutableSerializationDescriptor/deploymentPlatform

func (MPSGraphExecutableSerializationDescriptor) Init

Init initializes the instance.

func (MPSGraphExecutableSerializationDescriptor) MinimumDeploymentTarget

func (g MPSGraphExecutableSerializationDescriptor) MinimumDeploymentTarget() string

The minimum deployment target to serialize the executable.

Discussion

If not set, the package created will target the latest version of the `deploymentPlatform` set.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutableSerializationDescriptor/minimumDeploymentTarget

func (MPSGraphExecutableSerializationDescriptor) SetAppend

func (MPSGraphExecutableSerializationDescriptor) SetDeploymentPlatform

func (MPSGraphExecutableSerializationDescriptor) SetMinimumDeploymentTarget

func (g MPSGraphExecutableSerializationDescriptor) SetMinimumDeploymentTarget(value string)

type MPSGraphExecutableSerializationDescriptorClass

type MPSGraphExecutableSerializationDescriptorClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphExecutableSerializationDescriptorClass

func GetMPSGraphExecutableSerializationDescriptorClass() MPSGraphExecutableSerializationDescriptorClass

GetMPSGraphExecutableSerializationDescriptorClass returns the class object for MPSGraphExecutableSerializationDescriptor.

func (MPSGraphExecutableSerializationDescriptorClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphExecutableSerializationDescriptorClass) Class

Class returns the underlying Objective-C class pointer.

type MPSGraphExecutionDescriptor

type MPSGraphExecutionDescriptor struct {
	MPSGraphObject
}

A class that consists of all the levers to synchronize and schedule graph execution.

Instance Properties

Instance Methods

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutionDescriptor

func MPSGraphExecutionDescriptorFromID

func MPSGraphExecutionDescriptorFromID(id objc.ID) MPSGraphExecutionDescriptor

MPSGraphExecutionDescriptorFromID constructs a MPSGraphExecutionDescriptor from an objc.ID.

A class that consists of all the levers to synchronize and schedule graph execution.

func NewMPSGraphExecutionDescriptor

func NewMPSGraphExecutionDescriptor() MPSGraphExecutionDescriptor

NewMPSGraphExecutionDescriptor creates a new MPSGraphExecutionDescriptor instance.

func (MPSGraphExecutionDescriptor) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphExecutionDescriptor) CompilationDescriptor

The compilation descriptor for the graph.

Discussion

Default value is nil.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutionDescriptor/compilationDescriptor

func (MPSGraphExecutionDescriptor) CompletionHandler

The handler that graph calls at the completion of the execution.

Discussion

Default value is nil.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutionDescriptor/completionHandler

func (MPSGraphExecutionDescriptor) Init

Init initializes the instance.

func (MPSGraphExecutionDescriptor) ScheduledHandler

The handler that graph calls when it schedules the execution.

Discussion

Default value is nil.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutionDescriptor/scheduledHandler

func (MPSGraphExecutionDescriptor) SetCompilationDescriptor

func (g MPSGraphExecutionDescriptor) SetCompilationDescriptor(value IMPSGraphCompilationDescriptor)

func (MPSGraphExecutionDescriptor) SetCompletionHandler

func (g MPSGraphExecutionDescriptor) SetCompletionHandler(value objc.ID)

func (MPSGraphExecutionDescriptor) SetScheduledHandler

func (g MPSGraphExecutionDescriptor) SetScheduledHandler(value objc.ID)

func (MPSGraphExecutionDescriptor) SetWaitUntilCompleted

func (g MPSGraphExecutionDescriptor) SetWaitUntilCompleted(value bool)

func (MPSGraphExecutionDescriptor) SignalEventAtExecutionEventValue

func (g MPSGraphExecutionDescriptor) SignalEventAtExecutionEventValue(event metal.MTLSharedEvent, executionStage MPSGraphExecutionStage, value uint64)

Executable signals these shared events at execution stage and immediately proceeds.

event: Shared event to signal.

executionStage: Execution stage to signal event at.

value: Value for shared event to wait on.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutionDescriptor/signal(_:atExecutionEvent:value:)

func (MPSGraphExecutionDescriptor) WaitForEventValue

func (g MPSGraphExecutionDescriptor) WaitForEventValue(event metal.MTLSharedEvent, value uint64)

Executable waits on these shared events before scheduling execution on the HW, this does not include encoding which can still continue.

event: Shared event graph waits on.

value: Value of shared event graph waits on.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutionDescriptor/wait(for:value:)

func (MPSGraphExecutionDescriptor) WaitUntilCompleted

func (g MPSGraphExecutionDescriptor) WaitUntilCompleted() bool

The flag that blocks the execution call until the entire execution is complete.

Discussion

Defaults to NO.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutionDescriptor/waitUntilCompleted

type MPSGraphExecutionDescriptorClass

type MPSGraphExecutionDescriptorClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphExecutionDescriptorClass

func GetMPSGraphExecutionDescriptorClass() MPSGraphExecutionDescriptorClass

GetMPSGraphExecutionDescriptorClass returns the class object for MPSGraphExecutionDescriptor.

func (MPSGraphExecutionDescriptorClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphExecutionDescriptorClass) Class

Class returns the underlying Objective-C class pointer.

type MPSGraphExecutionStage

type MPSGraphExecutionStage uint64

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphExecutionStage

const (
	// MPSGraphExecutionStageCompleted: stage when execution of the graph completes.
	MPSGraphExecutionStageCompleted MPSGraphExecutionStage = 0
)

func (MPSGraphExecutionStage) String

func (e MPSGraphExecutionStage) String() string

type MPSGraphFFTDescriptor

type MPSGraphFFTDescriptor struct {
	MPSGraphObject
}

The class that defines the parameters for a fast Fourier transform (FFT) operation.

Overview

Use this descriptor with MPSGraph.FastFourierTransformWithTensorAxesDescriptorName, MPSGraph.RealToHermiteanFFTWithTensorAxesTensorDescriptorName, and MPSGraph.HermiteanToRealFFTWithTensorAxesTensorDescriptorName methods.

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphFFTDescriptor

func MPSGraphFFTDescriptorFromID

func MPSGraphFFTDescriptorFromID(id objc.ID) MPSGraphFFTDescriptor

MPSGraphFFTDescriptorFromID constructs a MPSGraphFFTDescriptor from an objc.ID.

The class that defines the parameters for a fast Fourier transform (FFT) operation.

func NewMPSGraphFFTDescriptor

func NewMPSGraphFFTDescriptor() MPSGraphFFTDescriptor

NewMPSGraphFFTDescriptor creates a new MPSGraphFFTDescriptor instance.

func (MPSGraphFFTDescriptor) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphFFTDescriptor) Init

Init initializes the instance.

func (MPSGraphFFTDescriptor) Inverse

func (g MPSGraphFFTDescriptor) Inverse() bool

A Boolean-valued parameter that defines the phase factor sign for Fourier transforms.

Discussion

When set to [YES] graph uses the positive phase factor: `exp(+i 2Pi mu nu / n)`, when computing the (inverse) Fourier transform. Otherwise MPSGraph uses the negative phase factor: `exp(-i 2Pi mu nu / n)`, when computing the Fourier transform. Default value: [NO].

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphFFTDescriptor/inverse

func (MPSGraphFFTDescriptor) RoundToOddHermitean

func (g MPSGraphFFTDescriptor) RoundToOddHermitean() bool

A parameter which controls how graph rounds the output tensor size for a Hermitean-to-real Fourier transform.

Discussion

If set to [YES] then MPSGraph rounds the last output dimension of the result tensor in MPSGraph.HermiteanToRealFFTWithTensorAxesTensorDescriptorName to an odd value. Has no effect in the other Fourier transform operations. Default value: [NO].

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphFFTDescriptor/roundToOddHermitean

func (MPSGraphFFTDescriptor) ScalingMode

The scaling mode of the fast fourier transform (FFT) operation.

Discussion

Note that the scaling mode is independent from the phase factor. Default value: MPSGraphFFTScalingModeNone.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphFFTDescriptor/scalingMode

func (MPSGraphFFTDescriptor) SetInverse

func (g MPSGraphFFTDescriptor) SetInverse(value bool)

func (MPSGraphFFTDescriptor) SetRoundToOddHermitean

func (g MPSGraphFFTDescriptor) SetRoundToOddHermitean(value bool)

func (MPSGraphFFTDescriptor) SetScalingMode

func (g MPSGraphFFTDescriptor) SetScalingMode(value MPSGraphFFTScalingMode)

type MPSGraphFFTDescriptorClass

type MPSGraphFFTDescriptorClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphFFTDescriptorClass

func GetMPSGraphFFTDescriptorClass() MPSGraphFFTDescriptorClass

GetMPSGraphFFTDescriptorClass returns the class object for MPSGraphFFTDescriptor.

func (MPSGraphFFTDescriptorClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphFFTDescriptorClass) Class

Class returns the underlying Objective-C class pointer.

func (MPSGraphFFTDescriptorClass) Descriptor

func (_MPSGraphFFTDescriptorClass MPSGraphFFTDescriptorClass) Descriptor() MPSGraphFFTDescriptor

Creates a fast Fourier transform descriptor with default parameter values.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphFFTDescriptor/descriptor

type MPSGraphFFTScalingMode

type MPSGraphFFTScalingMode uint

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphFFTScalingMode

const (
	// MPSGraphFFTScalingModeNone: Computes the FFT result with no scaling.
	MPSGraphFFTScalingModeNone MPSGraphFFTScalingMode = 0
	// MPSGraphFFTScalingModeSize: Scales the FFT result with reciprocal of the total FFT size over all transformed dimensions.
	MPSGraphFFTScalingModeSize MPSGraphFFTScalingMode = 1
	// MPSGraphFFTScalingModeUnitary: Scales the FFT result with reciprocal square root of the total FFT size over all transformed dimensions, resulting in signal strength conserving transformation.
	MPSGraphFFTScalingModeUnitary MPSGraphFFTScalingMode = 2
)

func (MPSGraphFFTScalingMode) String

func (e MPSGraphFFTScalingMode) String() string

type MPSGraphForLoopBodyBlock

type MPSGraphForLoopBodyBlock = func(index MPSGraphTensor, iterationArguments []MPSGraphTensor) []MPSGraphTensor

MPSGraphForLoopBodyBlock is a block for the body in the for loop.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphForLoopBodyBlock

type MPSGraphGRUDescriptor

type MPSGraphGRUDescriptor struct {
	MPSGraphObject
}

The class that defines the parameters for a gated recurrent unit (GRU) operation.

Overview

Use this descriptor with the following MPSGraph methods:

- MPSGraph.GRUWithSourceTensorRecurrentWeightInputWeightBiasDescriptorName - MPSGraph.GRUWithSourceTensorRecurrentWeightInputWeightBiasInitStateDescriptorName - MPSGraph.GRUWithSourceTensorRecurrentWeightInputWeightBiasInitStateMaskSecondaryBiasDescriptorName - MPSGraph.GRUGradientsWithSourceTensorRecurrentWeightSourceGradientZStateOutputFwdInputWeightBiasDescriptorName - MPSGraph.GRUGradientsWithSourceTensorRecurrentWeightSourceGradientZStateOutputFwdInputWeightBiasInitStateDescriptorName - MPSGraph.GRUGradientsWithSourceTensorRecurrentWeightSourceGradientZStateOutputFwdStateGradientInputWeightBiasInitStateMaskSecondaryBiasDescriptorName

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphGRUDescriptor

func MPSGraphGRUDescriptorFromID

func MPSGraphGRUDescriptorFromID(id objc.ID) MPSGraphGRUDescriptor

MPSGraphGRUDescriptorFromID constructs a MPSGraphGRUDescriptor from an objc.ID.

The class that defines the parameters for a gated recurrent unit (GRU) operation.

func NewMPSGraphGRUDescriptor

func NewMPSGraphGRUDescriptor() MPSGraphGRUDescriptor

NewMPSGraphGRUDescriptor creates a new MPSGraphGRUDescriptor instance.

func (MPSGraphGRUDescriptor) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphGRUDescriptor) Bidirectional

func (g MPSGraphGRUDescriptor) Bidirectional() bool

A parameter that defines a bidirectional GRU layer.

Discussion

If set to [YES] then the input sequence is traversed in both directions and the two results are concatenated together on the channel-axis. Default value: [NO].

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphGRUDescriptor/bidirectional

func (MPSGraphGRUDescriptor) FlipZ

func (g MPSGraphGRUDescriptor) FlipZ() bool

A parameter that chooses between two variants for the final output computation.

Discussion

If set to [YES] then the layer will compute the final value as `h[t] = z[t] h[t-1] + (1-z[t]) o[t]`. Otherwise it’s computed as `h[t] = (1-z[t]) h[t-1] + z[t] o[t]`. Default value: [NO].

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphGRUDescriptor/flipZ

func (MPSGraphGRUDescriptor) Init

Init initializes the instance.

func (MPSGraphGRUDescriptor) OutputGateActivation

func (g MPSGraphGRUDescriptor) OutputGateActivation() MPSGraphRNNActivation

A parameter that defines the activation function to use with the output-gate of the GRU operation.

Discussion

Default value: MPSGraphRNNActivationTanh.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphGRUDescriptor/outputGateActivation

func (MPSGraphGRUDescriptor) ResetAfter

func (g MPSGraphGRUDescriptor) ResetAfter() bool

A parameter that chooses between two variants for the reset gate computation.

Discussion

If set to [YES] then the layer will compute the intermediate value as `c[t] = ( b + (h[t-1] m ) R^T) r[t]`. Otherwise it’s computed as `c[t] = (h[t-1] r[t] m) R^T`. Default value: [NO].

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphGRUDescriptor/resetAfter

func (MPSGraphGRUDescriptor) ResetGateActivation

func (g MPSGraphGRUDescriptor) ResetGateActivation() MPSGraphRNNActivation

A parameter that defines the activation function to use with the reset-gate of the GRU operation.

Discussion

Default value: MPSGraphRNNActivationSigmoid.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphGRUDescriptor/resetGateActivation

func (MPSGraphGRUDescriptor) ResetGateFirst

func (g MPSGraphGRUDescriptor) ResetGateFirst() bool

A parameter that controls the internal order of the GRU gates.

Discussion

If set to [YES] then the layer will use the gate-ordering `[ r, z, o ]` instead of default `[ z, r, o ]`. Default value: [NO].

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphGRUDescriptor/resetGateFirst

func (MPSGraphGRUDescriptor) Reverse

func (g MPSGraphGRUDescriptor) Reverse() bool

A parameter that defines the time direction of the input sequence.

Discussion

If set to [YES] then the input sequence is passed in reverse time order to the layer. Note: Ignored when `bidirectional = YES`. Default value: [NO].

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphGRUDescriptor/reverse

func (MPSGraphGRUDescriptor) SetBidirectional

func (g MPSGraphGRUDescriptor) SetBidirectional(value bool)

func (MPSGraphGRUDescriptor) SetFlipZ

func (g MPSGraphGRUDescriptor) SetFlipZ(value bool)

func (MPSGraphGRUDescriptor) SetOutputGateActivation

func (g MPSGraphGRUDescriptor) SetOutputGateActivation(value MPSGraphRNNActivation)

func (MPSGraphGRUDescriptor) SetResetAfter

func (g MPSGraphGRUDescriptor) SetResetAfter(value bool)

func (MPSGraphGRUDescriptor) SetResetGateActivation

func (g MPSGraphGRUDescriptor) SetResetGateActivation(value MPSGraphRNNActivation)

func (MPSGraphGRUDescriptor) SetResetGateFirst

func (g MPSGraphGRUDescriptor) SetResetGateFirst(value bool)

func (MPSGraphGRUDescriptor) SetReverse

func (g MPSGraphGRUDescriptor) SetReverse(value bool)

func (MPSGraphGRUDescriptor) SetTraining

func (g MPSGraphGRUDescriptor) SetTraining(value bool)

func (MPSGraphGRUDescriptor) SetUpdateGateActivation

func (g MPSGraphGRUDescriptor) SetUpdateGateActivation(value MPSGraphRNNActivation)

func (MPSGraphGRUDescriptor) Training

func (g MPSGraphGRUDescriptor) Training() bool

A parameter that enables the GRU layer to support training.

Discussion

If set to [YES] then the layer will produce training state tensor as a secondary output. Default value: [NO].

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphGRUDescriptor/training

func (MPSGraphGRUDescriptor) UpdateGateActivation

func (g MPSGraphGRUDescriptor) UpdateGateActivation() MPSGraphRNNActivation

A parameter that defines the activation function to use with the update-gate of the GRU operation.

Discussion

Default value: MPSGraphRNNActivationSigmoid.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphGRUDescriptor/updateGateActivation

type MPSGraphGRUDescriptorClass

type MPSGraphGRUDescriptorClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphGRUDescriptorClass

func GetMPSGraphGRUDescriptorClass() MPSGraphGRUDescriptorClass

GetMPSGraphGRUDescriptorClass returns the class object for MPSGraphGRUDescriptor.

func (MPSGraphGRUDescriptorClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphGRUDescriptorClass) Class

Class returns the underlying Objective-C class pointer.

func (MPSGraphGRUDescriptorClass) Descriptor

func (_MPSGraphGRUDescriptorClass MPSGraphGRUDescriptorClass) Descriptor() MPSGraphGRUDescriptor

Creates an GRU descriptor with default values.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphGRUDescriptor/descriptor

type MPSGraphIfThenElseBlock

type MPSGraphIfThenElseBlock = func() []MPSGraphTensor

MPSGraphIfThenElseBlock is a block of operations executed under either the if or else condition.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphIfThenElseBlock

type MPSGraphImToColOpDescriptor

type MPSGraphImToColOpDescriptor struct {
	MPSGraphObject
}

The class that defines the parameters for an image to column or column to image operation.

Overview

Use this descriptor with the following MPSGraph methods:

- MPSGraph.ImToColWithSourceTensorDescriptorName - MPSGraph.ColToImWithSourceTensorOutputShapeDescriptorName

Instance Properties

Instance Methods

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphImToColOpDescriptor

func MPSGraphImToColOpDescriptorFromID

func MPSGraphImToColOpDescriptorFromID(id objc.ID) MPSGraphImToColOpDescriptor

MPSGraphImToColOpDescriptorFromID constructs a MPSGraphImToColOpDescriptor from an objc.ID.

The class that defines the parameters for an image to column or column to image operation.

func NewGraphImToColOpDescriptorWithKernelWidthKernelHeightStrideInXStrideInYDilationRateInXDilationRateInYDataLayout

func NewGraphImToColOpDescriptorWithKernelWidthKernelHeightStrideInXStrideInYDilationRateInXDilationRateInYDataLayout(kernelWidth uint, kernelHeight uint, strideInX uint, strideInY uint, dilationRateInX uint, dilationRateInY uint, dataLayout MPSGraphTensorNamedDataLayout) MPSGraphImToColOpDescriptor

Creates column to image descriptor with given values for parameters.

kernelWidth: See `kernelWidth` property.

kernelHeight: See `kernelHeight` property.

strideInX: See `strideInX` property.

strideInY: See `strideInY` property.

dilationRateInX: See `dilationRateInX` property.

dilationRateInY: See `dilationRateInY` property.

dataLayout: See `dataLayout` property.

Return Value

A valid MPSGraphImToColOpDescriptor on autoreleasepool.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphImToColOpDescriptor/init(kernelWidth:kernelHeight:strideInX:strideInY:dilationRateInX:dilationRateInY:dataLayout:)

func NewGraphImToColOpDescriptorWithKernelWidthKernelHeightStrideInXStrideInYDilationRateInXDilationRateInYPaddingLeftPaddingRightPaddingTopPaddingBottomDataLayout

func NewGraphImToColOpDescriptorWithKernelWidthKernelHeightStrideInXStrideInYDilationRateInXDilationRateInYPaddingLeftPaddingRightPaddingTopPaddingBottomDataLayout(kernelWidth uint, kernelHeight uint, strideInX uint, strideInY uint, dilationRateInX uint, dilationRateInY uint, paddingLeft uint, paddingRight uint, paddingTop uint, paddingBottom uint, dataLayout MPSGraphTensorNamedDataLayout) MPSGraphImToColOpDescriptor

Creates an image to column descriptor with given values for parameters.

kernelWidth: See `kernelWidth` property.

kernelHeight: See `kernelHeight` property.

strideInX: See `strideInX` property.

strideInY: See `strideInY` property.

dilationRateInX: See `dilationRateInX` property.

dilationRateInY: See `dilationRateInY` property.

paddingLeft: See `paddingLeft` property.

paddingRight: See `paddingRight` property.

paddingTop: See `paddingTop` property.

paddingBottom: See `paddingBottom` property.

dataLayout: See `dataLayout` property.

Return Value

A valid MPSGraphImToColOpDescriptor on autoreleasepool.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphImToColOpDescriptor/init(kernelWidth:kernelHeight:strideInX:strideInY:dilationRateInX:dilationRateInY:paddingLeft:paddingRight:paddingTop:paddingBottom:dataLayout:)

func NewMPSGraphImToColOpDescriptor

func NewMPSGraphImToColOpDescriptor() MPSGraphImToColOpDescriptor

NewMPSGraphImToColOpDescriptor creates a new MPSGraphImToColOpDescriptor instance.

func (MPSGraphImToColOpDescriptor) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphImToColOpDescriptor) DataLayout

The property that defines the layout of source or output tensor. e.g. `batch x channels x width x height` for [NCHW] layout

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphImToColOpDescriptor/dataLayout

func (MPSGraphImToColOpDescriptor) DilationRateInX

func (g MPSGraphImToColOpDescriptor) DilationRateInX() uint

The property that defines the dilation in width dimension.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphImToColOpDescriptor/dilationRateInX

func (MPSGraphImToColOpDescriptor) DilationRateInY

func (g MPSGraphImToColOpDescriptor) DilationRateInY() uint

The property that defines the dilation in height dimension.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphImToColOpDescriptor/dilationRateInY

func (MPSGraphImToColOpDescriptor) Init

Init initializes the instance.

func (MPSGraphImToColOpDescriptor) KernelHeight

func (g MPSGraphImToColOpDescriptor) KernelHeight() uint

The property that defines the kernel size in height dimension.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphImToColOpDescriptor/kernelHeight

func (MPSGraphImToColOpDescriptor) KernelWidth

func (g MPSGraphImToColOpDescriptor) KernelWidth() uint

The property that defines the kernel size in width dimension.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphImToColOpDescriptor/kernelWidth

func (MPSGraphImToColOpDescriptor) PaddingBottom

func (g MPSGraphImToColOpDescriptor) PaddingBottom() uint

The property that defines the padding in height dimension at the bottom.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphImToColOpDescriptor/paddingBottom

func (MPSGraphImToColOpDescriptor) PaddingLeft

func (g MPSGraphImToColOpDescriptor) PaddingLeft() uint

The property that defines the padding in width dimension on the left side.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphImToColOpDescriptor/paddingLeft

func (MPSGraphImToColOpDescriptor) PaddingRight

func (g MPSGraphImToColOpDescriptor) PaddingRight() uint

The property that defines the padding in width dimension on the right side.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphImToColOpDescriptor/paddingRight

func (MPSGraphImToColOpDescriptor) PaddingTop

func (g MPSGraphImToColOpDescriptor) PaddingTop() uint

The property that defines the padding in height dimension at the top.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphImToColOpDescriptor/paddingTop

func (MPSGraphImToColOpDescriptor) SetDataLayout

func (MPSGraphImToColOpDescriptor) SetDilationRateInX

func (g MPSGraphImToColOpDescriptor) SetDilationRateInX(value uint)

func (MPSGraphImToColOpDescriptor) SetDilationRateInY

func (g MPSGraphImToColOpDescriptor) SetDilationRateInY(value uint)

func (MPSGraphImToColOpDescriptor) SetExplicitPaddingWithPaddingLeftPaddingRightPaddingTopPaddingBottom

func (g MPSGraphImToColOpDescriptor) SetExplicitPaddingWithPaddingLeftPaddingRightPaddingTopPaddingBottom(paddingLeft uint, paddingRight uint, paddingTop uint, paddingBottom uint)

Sets the descriptor’s padding to the given values.

paddingLeft: See `paddingLeft` property.

paddingRight: See `paddingRight` property.

paddingTop: See `paddingTop` property.

paddingBottom: See `paddingBottom` property.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphImToColOpDescriptor/setExplicitPaddingWithPaddingLeft(_:paddingRight:paddingTop:paddingBottom:)

func (MPSGraphImToColOpDescriptor) SetKernelHeight

func (g MPSGraphImToColOpDescriptor) SetKernelHeight(value uint)

func (MPSGraphImToColOpDescriptor) SetKernelWidth

func (g MPSGraphImToColOpDescriptor) SetKernelWidth(value uint)

func (MPSGraphImToColOpDescriptor) SetPaddingBottom

func (g MPSGraphImToColOpDescriptor) SetPaddingBottom(value uint)

func (MPSGraphImToColOpDescriptor) SetPaddingLeft

func (g MPSGraphImToColOpDescriptor) SetPaddingLeft(value uint)

func (MPSGraphImToColOpDescriptor) SetPaddingRight

func (g MPSGraphImToColOpDescriptor) SetPaddingRight(value uint)

func (MPSGraphImToColOpDescriptor) SetPaddingTop

func (g MPSGraphImToColOpDescriptor) SetPaddingTop(value uint)

func (MPSGraphImToColOpDescriptor) SetStrideInX

func (g MPSGraphImToColOpDescriptor) SetStrideInX(value uint)

func (MPSGraphImToColOpDescriptor) SetStrideInY

func (g MPSGraphImToColOpDescriptor) SetStrideInY(value uint)

func (MPSGraphImToColOpDescriptor) StrideInX

func (g MPSGraphImToColOpDescriptor) StrideInX() uint

The property that defines the stride in width dimension.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphImToColOpDescriptor/strideInX

func (MPSGraphImToColOpDescriptor) StrideInY

func (g MPSGraphImToColOpDescriptor) StrideInY() uint

The property that defines the stride in height dimension.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphImToColOpDescriptor/strideInY

type MPSGraphImToColOpDescriptorClass

type MPSGraphImToColOpDescriptorClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphImToColOpDescriptorClass

func GetMPSGraphImToColOpDescriptorClass() MPSGraphImToColOpDescriptorClass

GetMPSGraphImToColOpDescriptorClass returns the class object for MPSGraphImToColOpDescriptor.

func (MPSGraphImToColOpDescriptorClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphImToColOpDescriptorClass) Class

Class returns the underlying Objective-C class pointer.

type MPSGraphLSTMDescriptor

type MPSGraphLSTMDescriptor struct {
	MPSGraphObject
}

The class that defines the parameters for a long short-term memory (LSTM) operation.

Overview

Use this descriptor with the following MPSGraph methods:

- MPSGraph.LSTMWithSourceTensorRecurrentWeightInitStateInitCellDescriptorName - MPSGraph.LSTMWithSourceTensorRecurrentWeightInputWeightBiasInitStateInitCellDescriptorName - MPSGraph.LSTMWithSourceTensorRecurrentWeightInputWeightBiasInitStateInitCellMaskPeepholeDescriptorName - MPSGraph.LSTMGradientsWithSourceTensorRecurrentWeightSourceGradientZStateCellOutputFwdDescriptorName - MPSGraph.LSTMGradientsWithSourceTensorRecurrentWeightSourceGradientZStateCellOutputFwdInputWeightBiasInitStateInitCellDescriptorName - MPSGraph.LSTMGradientsWithSourceTensorRecurrentWeightSourceGradientZStateCellOutputFwdInputWeightBiasInitStateInitCellMaskDescriptorName - MPSGraph.LSTMGradientsWithSourceTensorRecurrentWeightSourceGradientZStateCellOutputFwdStateGradientCellGradientInputWeightBiasInitStateInitCellMaskPeepholeDescriptorName

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphLSTMDescriptor

func MPSGraphLSTMDescriptorFromID

func MPSGraphLSTMDescriptorFromID(id objc.ID) MPSGraphLSTMDescriptor

MPSGraphLSTMDescriptorFromID constructs a MPSGraphLSTMDescriptor from an objc.ID.

The class that defines the parameters for a long short-term memory (LSTM) operation.

func NewMPSGraphLSTMDescriptor

func NewMPSGraphLSTMDescriptor() MPSGraphLSTMDescriptor

NewMPSGraphLSTMDescriptor creates a new MPSGraphLSTMDescriptor instance.

func (MPSGraphLSTMDescriptor) Activation

A parameter that defines the activation function used with the current cell value of the LSTM operation.

Discussion

Default value: MPSGraphRNNActivationTanh.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphLSTMDescriptor/activation

func (MPSGraphLSTMDescriptor) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphLSTMDescriptor) Bidirectional

func (g MPSGraphLSTMDescriptor) Bidirectional() bool

A parameter that defines a bidirectional LSTM layer.

Discussion

If set to [YES] then the input sequence is traversed in both directions and the two results are concatenated together on the channel-axis. Default value: [NO].

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphLSTMDescriptor/bidirectional

func (MPSGraphLSTMDescriptor) CellGateActivation

func (g MPSGraphLSTMDescriptor) CellGateActivation() MPSGraphRNNActivation

A parameter that defines the activation function used with the cell gate of the LSTM operation.

Discussion

Default value: MPSGraphRNNActivationTanh.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphLSTMDescriptor/cellGateActivation

func (MPSGraphLSTMDescriptor) ForgetGateActivation

func (g MPSGraphLSTMDescriptor) ForgetGateActivation() MPSGraphRNNActivation

A parameter that defines the activation function used with the forget gate of the LSTM operation.

Discussion

Default value: MPSGraphRNNActivationSigmoid.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphLSTMDescriptor/forgetGateActivation

func (MPSGraphLSTMDescriptor) ForgetGateLast

func (g MPSGraphLSTMDescriptor) ForgetGateLast() bool

A parameter that controls the internal order of the LSTM gates.

Discussion

If set to [YES] then the layer will use the gate-ordering `[ i, z, f, o ]` instead of default `[ i, f, z, o ]`. Default value: [NO]

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphLSTMDescriptor/forgetGateLast

func (MPSGraphLSTMDescriptor) Init

Init initializes the instance.

func (MPSGraphLSTMDescriptor) InputGateActivation

func (g MPSGraphLSTMDescriptor) InputGateActivation() MPSGraphRNNActivation

A parameter that defines the activation function used with the input gate of the LSTM operation.

Discussion

Default value: MPSGraphRNNActivationSigmoid.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphLSTMDescriptor/inputGateActivation

func (MPSGraphLSTMDescriptor) OutputGateActivation

func (g MPSGraphLSTMDescriptor) OutputGateActivation() MPSGraphRNNActivation

A parameter that defines the activation function used with the output gate of the LSTM operation.

Discussion

Default value: MPSGraphRNNActivationSigmoid.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphLSTMDescriptor/outputGateActivation

func (MPSGraphLSTMDescriptor) ProduceCell

func (g MPSGraphLSTMDescriptor) ProduceCell() bool

A parameter that controls whether or not to return the output cell from the LSTM layer.

Discussion

If set to [YES] then this layer will produce the internal cell of the LSTM unit as secondary output. Default value: [NO].

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphLSTMDescriptor/produceCell

func (MPSGraphLSTMDescriptor) Reverse

func (g MPSGraphLSTMDescriptor) Reverse() bool

A parameter that defines time direction of the input sequence.

Discussion

If set to [YES] then the input sequence is passed in reverse time order to the layer. Note: Ignored when `bidirectional = YES`. Default value: [NO].

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphLSTMDescriptor/reverse

func (MPSGraphLSTMDescriptor) SetActivation

func (g MPSGraphLSTMDescriptor) SetActivation(value MPSGraphRNNActivation)

func (MPSGraphLSTMDescriptor) SetBidirectional

func (g MPSGraphLSTMDescriptor) SetBidirectional(value bool)

func (MPSGraphLSTMDescriptor) SetCellGateActivation

func (g MPSGraphLSTMDescriptor) SetCellGateActivation(value MPSGraphRNNActivation)

func (MPSGraphLSTMDescriptor) SetForgetGateActivation

func (g MPSGraphLSTMDescriptor) SetForgetGateActivation(value MPSGraphRNNActivation)

func (MPSGraphLSTMDescriptor) SetForgetGateLast

func (g MPSGraphLSTMDescriptor) SetForgetGateLast(value bool)

func (MPSGraphLSTMDescriptor) SetInputGateActivation

func (g MPSGraphLSTMDescriptor) SetInputGateActivation(value MPSGraphRNNActivation)

func (MPSGraphLSTMDescriptor) SetOutputGateActivation

func (g MPSGraphLSTMDescriptor) SetOutputGateActivation(value MPSGraphRNNActivation)

func (MPSGraphLSTMDescriptor) SetProduceCell

func (g MPSGraphLSTMDescriptor) SetProduceCell(value bool)

func (MPSGraphLSTMDescriptor) SetReverse

func (g MPSGraphLSTMDescriptor) SetReverse(value bool)

func (MPSGraphLSTMDescriptor) SetTraining

func (g MPSGraphLSTMDescriptor) SetTraining(value bool)

func (MPSGraphLSTMDescriptor) Training

func (g MPSGraphLSTMDescriptor) Training() bool

A parameter that enables the LSTM layer to support training.

Discussion

If set to [YES] then the layer will produce training state tensor as a secondary output. Default value: [NO].

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphLSTMDescriptor/training

type MPSGraphLSTMDescriptorClass

type MPSGraphLSTMDescriptorClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphLSTMDescriptorClass

func GetMPSGraphLSTMDescriptorClass() MPSGraphLSTMDescriptorClass

GetMPSGraphLSTMDescriptorClass returns the class object for MPSGraphLSTMDescriptor.

func (MPSGraphLSTMDescriptorClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphLSTMDescriptorClass) Class

Class returns the underlying Objective-C class pointer.

func (MPSGraphLSTMDescriptorClass) Descriptor

func (_MPSGraphLSTMDescriptorClass MPSGraphLSTMDescriptorClass) Descriptor() MPSGraphLSTMDescriptor

Creates an LSTM descriptor with default values.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphLSTMDescriptor/descriptor

type MPSGraphLossReductionType

type MPSGraphLossReductionType uint64

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphLossReductionType

const (
	// MPSGraphLossReductionTypeAxis: Computes the loss without reduction.
	MPSGraphLossReductionTypeAxis MPSGraphLossReductionType = 0
	// MPSGraphLossReductionTypeMean: Reduces the loss down to a scalar with a mean operation.
	MPSGraphLossReductionTypeMean MPSGraphLossReductionType = 2
	// MPSGraphLossReductionTypeNone: Computes the loss without reduction.
	MPSGraphLossReductionTypeNone MPSGraphLossReductionType = 0
	// MPSGraphLossReductionTypeSum: Reduces the loss down to a scalar with a sum operation.
	MPSGraphLossReductionTypeSum MPSGraphLossReductionType = 1
)

func (MPSGraphLossReductionType) String

func (e MPSGraphLossReductionType) String() string

type MPSGraphNonMaximumSuppressionCoordinateMode

type MPSGraphNonMaximumSuppressionCoordinateMode uint

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphNonMaximumSuppressionCoordinateMode

const (
	MPSGraphNonMaximumSuppressionCoordinateModeCentersHeightFirst MPSGraphNonMaximumSuppressionCoordinateMode = 2
	MPSGraphNonMaximumSuppressionCoordinateModeCentersWidthFirst  MPSGraphNonMaximumSuppressionCoordinateMode = 3
	MPSGraphNonMaximumSuppressionCoordinateModeCornersHeightFirst MPSGraphNonMaximumSuppressionCoordinateMode = 0
	MPSGraphNonMaximumSuppressionCoordinateModeCornersWidthFirst  MPSGraphNonMaximumSuppressionCoordinateMode = 1
)

func (MPSGraphNonMaximumSuppressionCoordinateMode) String

type MPSGraphObject

type MPSGraphObject struct {
	objectivec.Object
}

The common base class for all Metal Performance Shaders Graph objects.

Overview

Only the child classes should be used.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphObject

func MPSGraphObjectFromID

func MPSGraphObjectFromID(id objc.ID) MPSGraphObject

MPSGraphObjectFromID constructs a MPSGraphObject from an objc.ID.

The common base class for all Metal Performance Shaders Graph objects.

func NewMPSGraphObject

func NewMPSGraphObject() MPSGraphObject

NewMPSGraphObject creates a new MPSGraphObject instance.

func (MPSGraphObject) Autorelease

func (g MPSGraphObject) Autorelease() MPSGraphObject

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphObject) Init

func (g MPSGraphObject) Init() MPSGraphObject

Init initializes the instance.

type MPSGraphObjectClass

type MPSGraphObjectClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphObjectClass

func GetMPSGraphObjectClass() MPSGraphObjectClass

GetMPSGraphObjectClass returns the class object for MPSGraphObject.

func (MPSGraphObjectClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphObjectClass) Class

func (mc MPSGraphObjectClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type MPSGraphOperation

type MPSGraphOperation struct {
	MPSGraphObject
}

A symbolic representation of a compute operation.

Overview

[NSCopy] will take a refrence, this is so [NSDictionary] can work with the tensor. All operations are created, owned and destroyed by the graph.

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphOperation

func MPSGraphOperationFromID

func MPSGraphOperationFromID(id objc.ID) MPSGraphOperation

MPSGraphOperationFromID constructs a MPSGraphOperation from an objc.ID.

A symbolic representation of a compute operation.

func NewMPSGraphOperation

func NewMPSGraphOperation() MPSGraphOperation

NewMPSGraphOperation creates a new MPSGraphOperation instance.

func (MPSGraphOperation) Autorelease

func (g MPSGraphOperation) Autorelease() MPSGraphOperation

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphOperation) ControlDependencies

func (g MPSGraphOperation) ControlDependencies() []MPSGraphOperation

The set of operations guaranteed to execute before this operation.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphOperation/controlDependencies

func (MPSGraphOperation) Graph

func (g MPSGraphOperation) Graph() IMPSGraph

The graph on which the operation is defined.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphOperation/graph

func (MPSGraphOperation) Init

Init initializes the instance.

func (MPSGraphOperation) InputTensors

func (g MPSGraphOperation) InputTensors() []MPSGraphTensor

The input tensors of the operation.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphOperation/inputTensors

func (MPSGraphOperation) OutputTensors

func (g MPSGraphOperation) OutputTensors() []MPSGraphTensor

The output tensors of the operation.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphOperation/outputTensors

type MPSGraphOperationClass

type MPSGraphOperationClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphOperationClass

func GetMPSGraphOperationClass() MPSGraphOperationClass

GetMPSGraphOperationClass returns the class object for MPSGraphOperation.

func (MPSGraphOperationClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphOperationClass) Class

func (mc MPSGraphOperationClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type MPSGraphOptimization

type MPSGraphOptimization uint64

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphOptimization

const (
	// MPSGraphOptimizationLevel0: Graph performs core optimizations only.
	MPSGraphOptimizationLevel0 MPSGraphOptimization = 0
	// MPSGraphOptimizationLevel1: Graph performs additional Optimizations, like using the placement pass to dispatch across different HW blocks like the NeuralEngine and CPU along with the GPU.
	MPSGraphOptimizationLevel1 MPSGraphOptimization = 1
)

func (MPSGraphOptimization) String

func (e MPSGraphOptimization) String() string

type MPSGraphOptimizationProfile

type MPSGraphOptimizationProfile uint64

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphOptimizationProfile

const (
	// MPSGraphOptimizationProfilePerformance: Default, graph optimized for performance.
	MPSGraphOptimizationProfilePerformance MPSGraphOptimizationProfile = 0
	// MPSGraphOptimizationProfilePowerEfficiency: Graph optimized for power efficiency.
	MPSGraphOptimizationProfilePowerEfficiency MPSGraphOptimizationProfile = 1
)

func (MPSGraphOptimizationProfile) String

type MPSGraphOptions

type MPSGraphOptions uint64

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphOptions

const (
	// MPSGraphOptionsDefault: The framework uses these options as default if not overriden.
	MPSGraphOptionsDefault MPSGraphOptions = 1
	// MPSGraphOptionsNone: No Options.
	MPSGraphOptionsNone MPSGraphOptions = 0
	// MPSGraphOptionsSynchronizeResults: The graph synchronizes results to the CPU using a blit encoder if on a discrete GPU at the end of execution.
	MPSGraphOptionsSynchronizeResults MPSGraphOptions = 1
	// MPSGraphOptionsVerbose: The framework prints more logging info.
	MPSGraphOptionsVerbose MPSGraphOptions = 2
)

func (MPSGraphOptions) String

func (e MPSGraphOptions) String() string

type MPSGraphPaddingMode

type MPSGraphPaddingMode int

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPaddingMode

const (
	// MPSGraphPaddingModeAntiPeriodic: Anti Periodic `x[-2] -> -x[L-3]`
	MPSGraphPaddingModeAntiPeriodic MPSGraphPaddingMode = 6
	// MPSGraphPaddingModeClampToEdge: ClampToEdge (PyTorch ReplicationPad)
	MPSGraphPaddingModeClampToEdge MPSGraphPaddingMode = 3
	// MPSGraphPaddingModeConstant: Constant
	MPSGraphPaddingModeConstant MPSGraphPaddingMode = 0
	// MPSGraphPaddingModePeriodic: Periodic `x[-2] -> x[L-3], where L is size of x.`
	MPSGraphPaddingModePeriodic MPSGraphPaddingMode = 5
	// MPSGraphPaddingModeReflect: Reflect
	MPSGraphPaddingModeReflect MPSGraphPaddingMode = 1
	// MPSGraphPaddingModeSymmetric: Symmetric
	MPSGraphPaddingModeSymmetric MPSGraphPaddingMode = 2
	// MPSGraphPaddingModeZero: Zero
	MPSGraphPaddingModeZero MPSGraphPaddingMode = 4
)

func (MPSGraphPaddingMode) String

func (e MPSGraphPaddingMode) String() string

type MPSGraphPaddingStyle

type MPSGraphPaddingStyle uint

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPaddingStyle

const (
	// MPSGraphPaddingStyleExplicit: Explicit
	MPSGraphPaddingStyleExplicit MPSGraphPaddingStyle = 0
	// MPSGraphPaddingStyleExplicitOffset: TF_VALID
	MPSGraphPaddingStyleExplicitOffset MPSGraphPaddingStyle = 3
	// MPSGraphPaddingStyleONNX_SAME_LOWER: Explicit offsets
	MPSGraphPaddingStyleONNX_SAME_LOWER MPSGraphPaddingStyle = 4
	// MPSGraphPaddingStyleTF_SAME: TF_SAME
	MPSGraphPaddingStyleTF_SAME MPSGraphPaddingStyle = 2
	// MPSGraphPaddingStyleTF_VALID: ONNX_SAME_LOWER
	MPSGraphPaddingStyleTF_VALID MPSGraphPaddingStyle = 1
)

func (MPSGraphPaddingStyle) String

func (e MPSGraphPaddingStyle) String() string

type MPSGraphPooling2DOpDescriptor

type MPSGraphPooling2DOpDescriptor struct {
	MPSGraphObject
}

The class that defines the parameters for a 2D pooling operation.

Overview

Use this descriptor with the following methods:

- MPSGraph.MaxPooling2DWithSourceTensorDescriptorName - MPSGraph.MaxPooling2DReturnIndicesWithSourceTensorDescriptorName - MPSGraph.MaxPooling2DGradientWithGradientTensorSourceTensorDescriptorName - MPSGraph.MaxPooling2DGradientWithGradientTensorIndicesTensorOutputShapeDescriptorName - MPSGraph.MaxPooling2DGradientWithGradientTensorIndicesTensorOutputShapeTensorDescriptorName - MPSGraph.AvgPooling2DWithSourceTensorDescriptorName - MPSGraph.AvgPooling2DGradientWithGradientTensorSourceTensorDescriptorName

Instance Properties

Instance Methods

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling2DOpDescriptor

func MPSGraphPooling2DOpDescriptorFromID

func MPSGraphPooling2DOpDescriptorFromID(id objc.ID) MPSGraphPooling2DOpDescriptor

MPSGraphPooling2DOpDescriptorFromID constructs a MPSGraphPooling2DOpDescriptor from an objc.ID.

The class that defines the parameters for a 2D pooling operation.

func NewGraphPooling2DOpDescriptorWithKernelWidthKernelHeightStrideInXStrideInYDilationRateInXDilationRateInYPaddingLeftPaddingRightPaddingTopPaddingBottomPaddingStyleDataLayout

func NewGraphPooling2DOpDescriptorWithKernelWidthKernelHeightStrideInXStrideInYDilationRateInXDilationRateInYPaddingLeftPaddingRightPaddingTopPaddingBottomPaddingStyleDataLayout(kernelWidth uint, kernelHeight uint, strideInX uint, strideInY uint, dilationRateInX uint, dilationRateInY uint, paddingLeft uint, paddingRight uint, paddingTop uint, paddingBottom uint, paddingStyle MPSGraphPaddingStyle, dataLayout MPSGraphTensorNamedDataLayout) MPSGraphPooling2DOpDescriptor

Creates a 2D pooling descriptor with given values.

kernelWidth: See `kernelWidth` property.

kernelHeight: See `kernelHeight` property.

strideInX: See `strideInX` property.

strideInY: See `strideInY` property.

dilationRateInX: See `dilationRateInX` property.

dilationRateInY: See `dilationRateInY` property.

paddingLeft: See `paddingLeft` property.

paddingRight: See `paddingRight` property.

paddingTop: See `paddingTop` property.

paddingBottom: See `paddingBottom` property.

paddingStyle: See `paddingStyle` property.

dataLayout: See `dataLayout` property.

Return Value

The descriptor on autoreleasepool.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling2DOpDescriptor/init(kernelWidth:kernelHeight:strideInX:strideInY:dilationRateInX:dilationRateInY:paddingLeft:paddingRight:paddingTop:paddingBottom:paddingStyle:dataLayout:)

func NewGraphPooling2DOpDescriptorWithKernelWidthKernelHeightStrideInXStrideInYPaddingStyleDataLayout

func NewGraphPooling2DOpDescriptorWithKernelWidthKernelHeightStrideInXStrideInYPaddingStyleDataLayout(kernelWidth uint, kernelHeight uint, strideInX uint, strideInY uint, paddingStyle MPSGraphPaddingStyle, dataLayout MPSGraphTensorNamedDataLayout) MPSGraphPooling2DOpDescriptor

Creates a 2D pooling descriptor with given values.

kernelWidth: See `kernelWidth` property.

kernelHeight: See `kernelHeight“ property.

strideInX: See `strideInX` property.

strideInY: See `strideInY` property.

paddingStyle: See `paddingStyle` property.

dataLayout: See `dataLayout` property.

Return Value

The descriptor on autoreleasepool.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling2DOpDescriptor/init(kernelWidth:kernelHeight:strideInX:strideInY:paddingStyle:dataLayout:)

func NewMPSGraphPooling2DOpDescriptor

func NewMPSGraphPooling2DOpDescriptor() MPSGraphPooling2DOpDescriptor

NewMPSGraphPooling2DOpDescriptor creates a new MPSGraphPooling2DOpDescriptor instance.

func (MPSGraphPooling2DOpDescriptor) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphPooling2DOpDescriptor) CeilMode

func (g MPSGraphPooling2DOpDescriptor) CeilMode() bool

Affects how the graph computes the output size.

Discussion

If set to [YES] then output size is computed by rounding up instead of down when dividing input size by stride. Default value: [NO].

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling2DOpDescriptor/ceilMode

func (MPSGraphPooling2DOpDescriptor) DataLayout

Defines the data layout of the input data in the forward pass. See: MPSGraphTensorNamedDataLayout.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling2DOpDescriptor/dataLayout

func (MPSGraphPooling2DOpDescriptor) DilationRateInX

func (g MPSGraphPooling2DOpDescriptor) DilationRateInX() uint

Defines the dilation rate for the width dimension.

Discussion

Default value: 1.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling2DOpDescriptor/dilationRateInX

func (MPSGraphPooling2DOpDescriptor) DilationRateInY

func (g MPSGraphPooling2DOpDescriptor) DilationRateInY() uint

Defines the dilation rate for the height dimension.

Discussion

Default value: 1.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling2DOpDescriptor/dilationRateInY

func (MPSGraphPooling2DOpDescriptor) IncludeZeroPadToAverage

func (g MPSGraphPooling2DOpDescriptor) IncludeZeroPadToAverage() bool

Defines a mode for average pooling, where samples outside the input tensor count as zeroes in the average computation.

Discussion

Otherwise the result is sum over samples divided by number of samples that didn’t come from padding. Default value: [NO].

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling2DOpDescriptor/includeZeroPadToAverage

func (MPSGraphPooling2DOpDescriptor) Init

Init initializes the instance.

func (MPSGraphPooling2DOpDescriptor) KernelHeight

func (g MPSGraphPooling2DOpDescriptor) KernelHeight() uint

Defines the pooling window size for the height dimension.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling2DOpDescriptor/kernelHeight

func (MPSGraphPooling2DOpDescriptor) KernelWidth

func (g MPSGraphPooling2DOpDescriptor) KernelWidth() uint

Defines the pooling window size for the width dimension.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling2DOpDescriptor/kernelWidth

func (MPSGraphPooling2DOpDescriptor) PaddingBottom

func (g MPSGraphPooling2DOpDescriptor) PaddingBottom() uint

Defines the explicit padding value for the height dimension to add after the data.

Discussion

Default value: 0.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling2DOpDescriptor/paddingBottom

func (MPSGraphPooling2DOpDescriptor) PaddingLeft

func (g MPSGraphPooling2DOpDescriptor) PaddingLeft() uint

Defines the explicit padding value for the width dimension to add before the data.

Discussion

Default value: 0.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling2DOpDescriptor/paddingLeft

func (MPSGraphPooling2DOpDescriptor) PaddingRight

func (g MPSGraphPooling2DOpDescriptor) PaddingRight() uint

Defines the explicit padding value for the width dimension to add after the data.

Discussion

Default value: 0.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling2DOpDescriptor/paddingRight

func (MPSGraphPooling2DOpDescriptor) PaddingStyle

Defines what kind of padding graph applies to the operation.

Discussion

Default value: MPSGraphPaddingStyleExplicit.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling2DOpDescriptor/paddingStyle

func (MPSGraphPooling2DOpDescriptor) PaddingTop

func (g MPSGraphPooling2DOpDescriptor) PaddingTop() uint

Defines the explicit padding value for the height dimension to add before the data.

Discussion

Default value: 0.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling2DOpDescriptor/paddingTop

func (MPSGraphPooling2DOpDescriptor) ReturnIndicesDataType

func (g MPSGraphPooling2DOpDescriptor) ReturnIndicesDataType() uint32

Defines the data type for returned indices. Use this in conjunction with MPSGraph.MaxPooling2DReturnIndicesWithSourceTensorDescriptorName API. Currently MPSGraph supports the following datatypes: [MPSDataTypeInt32]. Default value: [MPSDataTypeInt32].

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling2DOpDescriptor/returnIndicesDataType

func (MPSGraphPooling2DOpDescriptor) ReturnIndicesMode

Defines the mode for returned indices of maximum values within each pooling window. Use this in conjunction with MPSGraph.MaxPooling2DReturnIndicesWithSourceTensorDescriptorName API. If `returnIndicesMode = MPSGraphPoolingReturnIndicesNone` then only the first result MPSGraph returns from MPSGraph.MaxPooling2DReturnIndicesWithSourceTensorDescriptorName will be valid and using the second result will assert. Default value: MPSGraphPoolingReturnIndicesNone.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling2DOpDescriptor/returnIndicesMode

func (MPSGraphPooling2DOpDescriptor) SetCeilMode

func (g MPSGraphPooling2DOpDescriptor) SetCeilMode(value bool)

func (MPSGraphPooling2DOpDescriptor) SetDataLayout

func (MPSGraphPooling2DOpDescriptor) SetDilationRateInX

func (g MPSGraphPooling2DOpDescriptor) SetDilationRateInX(value uint)

func (MPSGraphPooling2DOpDescriptor) SetDilationRateInY

func (g MPSGraphPooling2DOpDescriptor) SetDilationRateInY(value uint)

func (MPSGraphPooling2DOpDescriptor) SetExplicitPaddingWithPaddingLeftPaddingRightPaddingTopPaddingBottom

func (g MPSGraphPooling2DOpDescriptor) SetExplicitPaddingWithPaddingLeftPaddingRightPaddingTopPaddingBottom(paddingLeft uint, paddingRight uint, paddingTop uint, paddingBottom uint)

Sets the explicit padding values and sets padding style to explicit.

paddingLeft: See `paddingLeft` property.

paddingRight: See `paddingRight` property.

paddingTop: See `paddingTop` property.

paddingBottom: See `paddingBottom` property.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling2DOpDescriptor/setExplicitPaddingWithPaddingLeft(_:paddingRight:paddingTop:paddingBottom:)

func (MPSGraphPooling2DOpDescriptor) SetIncludeZeroPadToAverage

func (g MPSGraphPooling2DOpDescriptor) SetIncludeZeroPadToAverage(value bool)

func (MPSGraphPooling2DOpDescriptor) SetKernelHeight

func (g MPSGraphPooling2DOpDescriptor) SetKernelHeight(value uint)

func (MPSGraphPooling2DOpDescriptor) SetKernelWidth

func (g MPSGraphPooling2DOpDescriptor) SetKernelWidth(value uint)

func (MPSGraphPooling2DOpDescriptor) SetPaddingBottom

func (g MPSGraphPooling2DOpDescriptor) SetPaddingBottom(value uint)

func (MPSGraphPooling2DOpDescriptor) SetPaddingLeft

func (g MPSGraphPooling2DOpDescriptor) SetPaddingLeft(value uint)

func (MPSGraphPooling2DOpDescriptor) SetPaddingRight

func (g MPSGraphPooling2DOpDescriptor) SetPaddingRight(value uint)

func (MPSGraphPooling2DOpDescriptor) SetPaddingStyle

func (g MPSGraphPooling2DOpDescriptor) SetPaddingStyle(value MPSGraphPaddingStyle)

func (MPSGraphPooling2DOpDescriptor) SetPaddingTop

func (g MPSGraphPooling2DOpDescriptor) SetPaddingTop(value uint)

func (MPSGraphPooling2DOpDescriptor) SetReturnIndicesDataType

func (g MPSGraphPooling2DOpDescriptor) SetReturnIndicesDataType(value uint32)

func (MPSGraphPooling2DOpDescriptor) SetReturnIndicesMode

func (MPSGraphPooling2DOpDescriptor) SetStrideInX

func (g MPSGraphPooling2DOpDescriptor) SetStrideInX(value uint)

func (MPSGraphPooling2DOpDescriptor) SetStrideInY

func (g MPSGraphPooling2DOpDescriptor) SetStrideInY(value uint)

func (MPSGraphPooling2DOpDescriptor) StrideInX

func (g MPSGraphPooling2DOpDescriptor) StrideInX() uint

Defines the stride for the width dimension.

Discussion

Default value: 1.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling2DOpDescriptor/strideInX

func (MPSGraphPooling2DOpDescriptor) StrideInY

func (g MPSGraphPooling2DOpDescriptor) StrideInY() uint

Defines the stride for the height dimension.

Discussion

Default value: 1.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling2DOpDescriptor/strideInY

type MPSGraphPooling2DOpDescriptorClass

type MPSGraphPooling2DOpDescriptorClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphPooling2DOpDescriptorClass

func GetMPSGraphPooling2DOpDescriptorClass() MPSGraphPooling2DOpDescriptorClass

GetMPSGraphPooling2DOpDescriptorClass returns the class object for MPSGraphPooling2DOpDescriptor.

func (MPSGraphPooling2DOpDescriptorClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphPooling2DOpDescriptorClass) Class

Class returns the underlying Objective-C class pointer.

type MPSGraphPooling4DOpDescriptor

type MPSGraphPooling4DOpDescriptor struct {
	MPSGraphObject
}

The class that defines the parameters for a 4D pooling operation.

Overview

Use this descriptor with the following methods:

- MPSGraph.MaxPooling4DWithSourceTensorDescriptorName - MPSGraph.MaxPooling4DReturnIndicesWithSourceTensorDescriptorName - MPSGraph.MaxPooling4DGradientWithGradientTensorSourceTensorDescriptorName - MPSGraph.MaxPooling4DGradientWithGradientTensorIndicesTensorOutputShapeDescriptorName - MPSGraph.MaxPooling4DGradientWithGradientTensorIndicesTensorOutputShapeTensorDescriptorName - MPSGraph.AvgPooling4DWithSourceTensorDescriptorName - MPSGraph.AvgPooling4DGradientWithGradientTensorSourceTensorDescriptorName - MPSGraph.L2NormPooling4DWithSourceTensorDescriptorName - MPSGraph.L2NormPooling4DGradientWithGradientTensorSourceTensorDescriptorName

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling4DOpDescriptor

func MPSGraphPooling4DOpDescriptorFromID

func MPSGraphPooling4DOpDescriptorFromID(id objc.ID) MPSGraphPooling4DOpDescriptor

MPSGraphPooling4DOpDescriptorFromID constructs a MPSGraphPooling4DOpDescriptor from an objc.ID.

The class that defines the parameters for a 4D pooling operation.

func NewGraphPooling4DOpDescriptorWithKernelSizesPaddingStyle

func NewGraphPooling4DOpDescriptorWithKernelSizesPaddingStyle(kernelSizes []foundation.NSNumber, paddingStyle MPSGraphPaddingStyle) MPSGraphPooling4DOpDescriptor

Creates a 4D pooling descriptor with default values.

kernelSizes: See `kernelSizes` property.

paddingStyle: See `paddingStyle` property.

Return Value

The descriptor on autoreleasepool.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling4DOpDescriptor/init(kernelSizes:paddingStyle:)

func NewGraphPooling4DOpDescriptorWithKernelSizesStridesDilationRatesPaddingValuesPaddingStyle

func NewGraphPooling4DOpDescriptorWithKernelSizesStridesDilationRatesPaddingValuesPaddingStyle(kernelSizes []foundation.NSNumber, strides []foundation.NSNumber, dilationRates []foundation.NSNumber, paddingValues []foundation.NSNumber, paddingStyle MPSGraphPaddingStyle) MPSGraphPooling4DOpDescriptor

Creates a 4D pooling descriptor with given values.

kernelSizes: See `kernelSizes` property.

strides: See `strides` property.

dilationRates: See `dilationRates` property.

paddingValues: See `paddingValues` property.

paddingStyle: See `paddingStyle` property.

Return Value

The descriptor on autoreleasepool.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling4DOpDescriptor/init(kernelSizes:strides:dilationRates:paddingValues:paddingStyle:)

func NewMPSGraphPooling4DOpDescriptor

func NewMPSGraphPooling4DOpDescriptor() MPSGraphPooling4DOpDescriptor

NewMPSGraphPooling4DOpDescriptor creates a new MPSGraphPooling4DOpDescriptor instance.

func (MPSGraphPooling4DOpDescriptor) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphPooling4DOpDescriptor) CeilMode

func (g MPSGraphPooling4DOpDescriptor) CeilMode() bool

Affects how MPSGraph computes the output size: if set to [YES] then output size is computed by rounding up instead of down when dividing input size by stride.

Discussion

Default value: [NO].

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling4DOpDescriptor/ceilMode

func (MPSGraphPooling4DOpDescriptor) DilationRates

Defines dilation rates for spatial dimensions. Must be four numbers, one for each spatial dimension, fastest running index last.

Discussion

Default value: `@[ @1, @1, @1, @1 ]`

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling4DOpDescriptor/dilationRates

func (MPSGraphPooling4DOpDescriptor) IncludeZeroPadToAverage

func (g MPSGraphPooling4DOpDescriptor) IncludeZeroPadToAverage() bool

Defines a mode for average pooling, where samples outside the input tensor count as zeroes in the average computation.

Discussion

Otherwise the result is sum over samples divided by number of samples that didn’t come from padding. Default value: [NO].

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling4DOpDescriptor/includeZeroPadToAverage

func (MPSGraphPooling4DOpDescriptor) Init

Init initializes the instance.

func (MPSGraphPooling4DOpDescriptor) KernelSizes

Defines the pooling window size.

Discussion

Must be four numbers, one for each spatial dimension, fastest running index last.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling4DOpDescriptor/kernelSizes

func (MPSGraphPooling4DOpDescriptor) PaddingStyle

Defines what kind of padding graph applies to the operation.

Discussion

Default value: MPSGraphPaddingStyleExplicit.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling4DOpDescriptor/paddingStyle

func (MPSGraphPooling4DOpDescriptor) PaddingValues

Defines padding values for spatial dimensions which must be eight numbers, two for each spatial dimension.

Discussion

For example `paddingValues[0]` defines the explicit padding amount before the first spatial dimension (slowest running index of spatial dimensions), `paddingValues[1]` defines the padding amount after the first spatial dimension etc. Used only when `paddingStyle = MPSGraphPaddingStyleExplicit`. Default value: `@[ @0, @0, @0, @0, @0, @0, @0, @0 ]`

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling4DOpDescriptor/paddingValues

func (MPSGraphPooling4DOpDescriptor) ReturnIndicesDataType

func (g MPSGraphPooling4DOpDescriptor) ReturnIndicesDataType() uint32

Defines the data type for returned indices.

Discussion

Use this in conjunction with MPSGraph.MaxPooling4DReturnIndicesWithSourceTensorDescriptorName API. Currently MPSGraph supports the following datatypes: [MPSDataTypeInt32]. Default value: [MPSDataTypeInt32].

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling4DOpDescriptor/returnIndicesDataType

func (MPSGraphPooling4DOpDescriptor) ReturnIndicesMode

Defines the mode for returned indices of maximum values within each pooling window.

Discussion

Use this in conjunction with MPSGraph.MaxPooling4DReturnIndicesWithSourceTensorDescriptorName API. If `returnIndicesMode = MPSGraphPoolingReturnIndicesNone` then only the first result MPSGraph returns from MPSGraph.MaxPooling4DReturnIndicesWithSourceTensorDescriptorName will be valid and using the second result will assert. Default value: MPSGraphPoolingReturnIndicesNone.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling4DOpDescriptor/returnIndicesMode

func (MPSGraphPooling4DOpDescriptor) SetCeilMode

func (g MPSGraphPooling4DOpDescriptor) SetCeilMode(value bool)

func (MPSGraphPooling4DOpDescriptor) SetDilationRates

func (g MPSGraphPooling4DOpDescriptor) SetDilationRates(value []foundation.NSNumber)

func (MPSGraphPooling4DOpDescriptor) SetIncludeZeroPadToAverage

func (g MPSGraphPooling4DOpDescriptor) SetIncludeZeroPadToAverage(value bool)

func (MPSGraphPooling4DOpDescriptor) SetKernelSizes

func (g MPSGraphPooling4DOpDescriptor) SetKernelSizes(value []foundation.NSNumber)

func (MPSGraphPooling4DOpDescriptor) SetPaddingStyle

func (g MPSGraphPooling4DOpDescriptor) SetPaddingStyle(value MPSGraphPaddingStyle)

func (MPSGraphPooling4DOpDescriptor) SetPaddingValues

func (g MPSGraphPooling4DOpDescriptor) SetPaddingValues(value []foundation.NSNumber)

func (MPSGraphPooling4DOpDescriptor) SetReturnIndicesDataType

func (g MPSGraphPooling4DOpDescriptor) SetReturnIndicesDataType(value uint32)

func (MPSGraphPooling4DOpDescriptor) SetReturnIndicesMode

func (MPSGraphPooling4DOpDescriptor) SetStrides

func (g MPSGraphPooling4DOpDescriptor) SetStrides(value []foundation.NSNumber)

func (MPSGraphPooling4DOpDescriptor) Strides

Defines strides for spatial dimensions. Must be four numbers, one for each spatial dimension, fastest running index last.

Discussion

Default value: `@[ @1, @1, @1, @1 ]`

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPooling4DOpDescriptor/strides

type MPSGraphPooling4DOpDescriptorClass

type MPSGraphPooling4DOpDescriptorClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphPooling4DOpDescriptorClass

func GetMPSGraphPooling4DOpDescriptorClass() MPSGraphPooling4DOpDescriptorClass

GetMPSGraphPooling4DOpDescriptorClass returns the class object for MPSGraphPooling4DOpDescriptor.

func (MPSGraphPooling4DOpDescriptorClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphPooling4DOpDescriptorClass) Class

Class returns the underlying Objective-C class pointer.

type MPSGraphPoolingReturnIndicesMode

type MPSGraphPoolingReturnIndicesMode uint

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphPoolingReturnIndicesMode

const (
	// MPSGraphPoolingReturnIndicesGlobalFlatten1D: Returns indices flattened in inner most (last) dimension.
	MPSGraphPoolingReturnIndicesGlobalFlatten1D MPSGraphPoolingReturnIndicesMode = 1
	// MPSGraphPoolingReturnIndicesGlobalFlatten2D: Returns indices flattened in 2 innermost dimensions.
	MPSGraphPoolingReturnIndicesGlobalFlatten2D MPSGraphPoolingReturnIndicesMode = 2
	// MPSGraphPoolingReturnIndicesGlobalFlatten3D: Returns indices flattened in 3 innernost dimensions.
	MPSGraphPoolingReturnIndicesGlobalFlatten3D MPSGraphPoolingReturnIndicesMode = 3
	// MPSGraphPoolingReturnIndicesGlobalFlatten4D: Returns indices flattened in 4 innermost dimensions.
	MPSGraphPoolingReturnIndicesGlobalFlatten4D MPSGraphPoolingReturnIndicesMode = 4
	// MPSGraphPoolingReturnIndicesLocalFlatten1D: Returns indices within pooling window, flattened in inner most dimension.
	MPSGraphPoolingReturnIndicesLocalFlatten1D MPSGraphPoolingReturnIndicesMode = 5
	// MPSGraphPoolingReturnIndicesLocalFlatten2D: Returns indices within pooling window, flattened in 2 innermost dimensions.
	MPSGraphPoolingReturnIndicesLocalFlatten2D MPSGraphPoolingReturnIndicesMode = 6
	// MPSGraphPoolingReturnIndicesLocalFlatten3D: Returns indices within pooling window, flattened in 3 innernost dimensions.
	MPSGraphPoolingReturnIndicesLocalFlatten3D MPSGraphPoolingReturnIndicesMode = 7
	// MPSGraphPoolingReturnIndicesLocalFlatten4D: Returns indices within pooling window, flattened in 4 innermost dimensions.
	MPSGraphPoolingReturnIndicesLocalFlatten4D MPSGraphPoolingReturnIndicesMode = 8
	// MPSGraphPoolingReturnIndicesNone: No indices returned.
	MPSGraphPoolingReturnIndicesNone MPSGraphPoolingReturnIndicesMode = 0
)

func (MPSGraphPoolingReturnIndicesMode) String

type MPSGraphRNNActivation

type MPSGraphRNNActivation uint

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphRNNActivation

const (
	// MPSGraphRNNActivationHardSigmoid: Defines a Hard sigmoid activation.
	MPSGraphRNNActivationHardSigmoid MPSGraphRNNActivation = 4
	// MPSGraphRNNActivationNone: Defines a pass through activation.
	MPSGraphRNNActivationNone MPSGraphRNNActivation = 0
	// MPSGraphRNNActivationRelu: Defines a ReLU activation.
	MPSGraphRNNActivationRelu MPSGraphRNNActivation = 1
	// MPSGraphRNNActivationSigmoid: Defines a Sigmoid activation.
	MPSGraphRNNActivationSigmoid MPSGraphRNNActivation = 3
	// MPSGraphRNNActivationTanh: Defines a Tanh activation.
	MPSGraphRNNActivationTanh MPSGraphRNNActivation = 2
)

func (MPSGraphRNNActivation) String

func (e MPSGraphRNNActivation) String() string

type MPSGraphRandomDistribution

type MPSGraphRandomDistribution uint64

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphRandomDistribution

const (
	// MPSGraphRandomDistributionNormal: The normal distribution defined by mean and standard deviation.
	MPSGraphRandomDistributionNormal MPSGraphRandomDistribution = 1
	// MPSGraphRandomDistributionTruncatedNormal: The normal distribution defined by mean and standard deviation, truncated to the range [min, max)
	MPSGraphRandomDistributionTruncatedNormal MPSGraphRandomDistribution = 2
	// MPSGraphRandomDistributionUniform: The uniform distribution, with samples drawn uniformly from [min, max) for float types, and [min, max] for integer types.
	MPSGraphRandomDistributionUniform MPSGraphRandomDistribution = 0
)

func (MPSGraphRandomDistribution) String

type MPSGraphRandomNormalSamplingMethod

type MPSGraphRandomNormalSamplingMethod uint64

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphRandomNormalSamplingMethod

const (
	// MPSGraphRandomNormalSamplingBoxMuller: Use Box Muller transform to convert uniform values to values in the normal distribution.
	MPSGraphRandomNormalSamplingBoxMuller MPSGraphRandomNormalSamplingMethod = 1
	// MPSGraphRandomNormalSamplingInvCDF: Use inverse erf to convert uniform values to values in the normal distribution
	MPSGraphRandomNormalSamplingInvCDF MPSGraphRandomNormalSamplingMethod = 0
)

func (MPSGraphRandomNormalSamplingMethod) String

type MPSGraphRandomOpDescriptor

type MPSGraphRandomOpDescriptor struct {
	MPSGraphObject
}

A class that describes the random operation.

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphRandomOpDescriptor

func MPSGraphRandomOpDescriptorFromID

func MPSGraphRandomOpDescriptorFromID(id objc.ID) MPSGraphRandomOpDescriptor

MPSGraphRandomOpDescriptorFromID constructs a MPSGraphRandomOpDescriptor from an objc.ID.

A class that describes the random operation.

func NewMPSGraphRandomOpDescriptor

func NewMPSGraphRandomOpDescriptor() MPSGraphRandomOpDescriptor

NewMPSGraphRandomOpDescriptor creates a new MPSGraphRandomOpDescriptor instance.

func (MPSGraphRandomOpDescriptor) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphRandomOpDescriptor) DataType

func (g MPSGraphRandomOpDescriptor) DataType() uint32

The data type of the generated result values.

Discussion

When sampling from the uniform distribution, valid types are MPSDataTypeFloat16, MPSDataTypeFloat32, and MPSDataTypeInt32. When sampling from the normal or truncated normal distribution, valid types are MPSDataTypeFloat16 and MPSDataTypeFloat32.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphRandomOpDescriptor/dataType

func (MPSGraphRandomOpDescriptor) Distribution

The type of distribution to draw samples from. See MPSGraphRandomDistribution.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphRandomOpDescriptor/distribution

func (MPSGraphRandomOpDescriptor) Init

Init initializes the instance.

func (MPSGraphRandomOpDescriptor) Max

The upper range of the distribution.

Discussion

This value is used for Uniform distributions with float data types and Truncated Normal disributions. Defaults to 1 for uniform distributions and 2 for normal distributions.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphRandomOpDescriptor/max

func (MPSGraphRandomOpDescriptor) MaxInteger

func (g MPSGraphRandomOpDescriptor) MaxInteger() int

The upper range of the distribution.

Discussion

This value is used for Uniform with integer data types Defaults to INT32_MAX for uniform distributions and 0 for normal distributions.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphRandomOpDescriptor/maxInteger

func (MPSGraphRandomOpDescriptor) Mean

The mean of the distribution.

Discussion

This value is used for Normal and Truncated Normal disributions. Defaults to 0.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphRandomOpDescriptor/mean

func (MPSGraphRandomOpDescriptor) Min

The lower range of the distribution.

Discussion

This value is used for Uniform distributions with float data types and Truncated Normal disributions. Defaults to 0 for uniform distributions and -2 for normal distributions.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphRandomOpDescriptor/min

func (MPSGraphRandomOpDescriptor) MinInteger

func (g MPSGraphRandomOpDescriptor) MinInteger() int

The lower range of the distribution.

Discussion

This value is used for Uniform with integer data types Defaults to 0.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphRandomOpDescriptor/minInteger

func (MPSGraphRandomOpDescriptor) SamplingMethod

The sampling method of the distribution.

Discussion

This value is used for Normal and Truncated Normal disributions. See MPSGraphRandomNormalSamplingMethod. Defaults to MPSGraphRandomNormalSamplingInvCDF.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphRandomOpDescriptor/samplingMethod

func (MPSGraphRandomOpDescriptor) SetDataType

func (g MPSGraphRandomOpDescriptor) SetDataType(value uint32)

func (MPSGraphRandomOpDescriptor) SetDistribution

func (g MPSGraphRandomOpDescriptor) SetDistribution(value MPSGraphRandomDistribution)

func (MPSGraphRandomOpDescriptor) SetMax

func (g MPSGraphRandomOpDescriptor) SetMax(value float32)

func (MPSGraphRandomOpDescriptor) SetMaxInteger

func (g MPSGraphRandomOpDescriptor) SetMaxInteger(value int)

func (MPSGraphRandomOpDescriptor) SetMean

func (g MPSGraphRandomOpDescriptor) SetMean(value float32)

func (MPSGraphRandomOpDescriptor) SetMin

func (g MPSGraphRandomOpDescriptor) SetMin(value float32)

func (MPSGraphRandomOpDescriptor) SetMinInteger

func (g MPSGraphRandomOpDescriptor) SetMinInteger(value int)

func (MPSGraphRandomOpDescriptor) SetSamplingMethod

func (MPSGraphRandomOpDescriptor) SetStandardDeviation

func (g MPSGraphRandomOpDescriptor) SetStandardDeviation(value float32)

func (MPSGraphRandomOpDescriptor) StandardDeviation

func (g MPSGraphRandomOpDescriptor) StandardDeviation() float32

The standard deviation of the distribution.

Discussion

This value is used for Normal and Truncated Normal disributions. For Truncated Normal distribution this defines the standard deviation parameter of the underlying Normal distribution, that is the width of the Gaussian, not the true standard deviation of the truncated distribution which typically differs from the standard deviation of the original Normal distribution. Defaults to 0 for uniform distributions and 1 for normal distributions.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphRandomOpDescriptor/standardDeviation

type MPSGraphRandomOpDescriptorClass

type MPSGraphRandomOpDescriptorClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphRandomOpDescriptorClass

func GetMPSGraphRandomOpDescriptorClass() MPSGraphRandomOpDescriptorClass

GetMPSGraphRandomOpDescriptorClass returns the class object for MPSGraphRandomOpDescriptor.

func (MPSGraphRandomOpDescriptorClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphRandomOpDescriptorClass) Class

Class returns the underlying Objective-C class pointer.

type MPSGraphReducedPrecisionFastMath

type MPSGraphReducedPrecisionFastMath uint

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphReducedPrecisionFastMath

const (
	// MPSGraphReducedPrecisionFastMathAllowFP16Conv2DWinogradTransformIntermediate: Execute winograd transform intermediate as FP16.
	MPSGraphReducedPrecisionFastMathAllowFP16Conv2DWinogradTransformIntermediate MPSGraphReducedPrecisionFastMath = 2
	// MPSGraphReducedPrecisionFastMathAllowFP16Intermediates: Curated list allowing intermediates for multi-pass GPU kernels to be FP16.
	MPSGraphReducedPrecisionFastMathAllowFP16Intermediates MPSGraphReducedPrecisionFastMath = 2
	// MPSGraphReducedPrecisionFastMathDefault: Default selection.
	MPSGraphReducedPrecisionFastMathDefault MPSGraphReducedPrecisionFastMath = 0
	// MPSGraphReducedPrecisionFastMathNone: Full precision math with maximum accuracy.
	MPSGraphReducedPrecisionFastMathNone MPSGraphReducedPrecisionFastMath = 0
)

func (MPSGraphReducedPrecisionFastMath) String

type MPSGraphReductionMode

type MPSGraphReductionMode uint

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphReductionMode

const (
	// MPSGraphReductionModeArgumentMax: Argument Max
	MPSGraphReductionModeArgumentMax MPSGraphReductionMode = 5
	// MPSGraphReductionModeArgumentMin: Argument Min
	MPSGraphReductionModeArgumentMin MPSGraphReductionMode = 4
	// MPSGraphReductionModeMax: Max
	MPSGraphReductionModeMax MPSGraphReductionMode = 1
	// MPSGraphReductionModeMin: Min
	MPSGraphReductionModeMin MPSGraphReductionMode = 0
	// MPSGraphReductionModeProduct: Product
	MPSGraphReductionModeProduct MPSGraphReductionMode = 3
	// MPSGraphReductionModeSum: Sum
	MPSGraphReductionModeSum MPSGraphReductionMode = 2
)

func (MPSGraphReductionMode) String

func (e MPSGraphReductionMode) String() string

type MPSGraphResizeMode

type MPSGraphResizeMode uint

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphResizeMode

const (
	// MPSGraphResizeBilinear: Samples the 4 neighbors to the pixel coordinate and uses bilinear interpolation.
	MPSGraphResizeBilinear MPSGraphResizeMode = 1
	// MPSGraphResizeNearest: Samples the nearest neighbor to the pixel coordinate.
	MPSGraphResizeNearest MPSGraphResizeMode = 0
)

func (MPSGraphResizeMode) String

func (e MPSGraphResizeMode) String() string

type MPSGraphResizeNearestRoundingMode

type MPSGraphResizeNearestRoundingMode uint

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphResizeNearestRoundingMode

const (
	// MPSGraphResizeNearestRoundingModeCeil: Rounds values toward +inf.
	MPSGraphResizeNearestRoundingModeCeil MPSGraphResizeNearestRoundingMode = 2
	// MPSGraphResizeNearestRoundingModeFloor: Rounds values toward -inf.
	MPSGraphResizeNearestRoundingModeFloor MPSGraphResizeNearestRoundingMode = 3
	// MPSGraphResizeNearestRoundingModeRoundPreferCeil: Rounds values to the nearest integer value, with 0.5f offset rounding toward +inf.
	MPSGraphResizeNearestRoundingModeRoundPreferCeil MPSGraphResizeNearestRoundingMode = 0
	// MPSGraphResizeNearestRoundingModeRoundPreferFloor: Rounds values to the nearest integer value, with 0.5f rounding toward -inf.
	MPSGraphResizeNearestRoundingModeRoundPreferFloor MPSGraphResizeNearestRoundingMode = 1
	// MPSGraphResizeNearestRoundingModeRoundToEven: Rounds values to the nearest integer value, with 0.5f rounding toward the closest even value.
	MPSGraphResizeNearestRoundingModeRoundToEven MPSGraphResizeNearestRoundingMode = 4
	// MPSGraphResizeNearestRoundingModeRoundToOdd: Rounds values to the nearest integer value, with 0.5f rounding toward the closest odd value.
	MPSGraphResizeNearestRoundingModeRoundToOdd MPSGraphResizeNearestRoundingMode = 5
)

func (MPSGraphResizeNearestRoundingMode) String

type MPSGraphSDPADescriptor

type MPSGraphSDPADescriptor struct {
	MPSGraphObject
}

A descriptor that configures a scaled dot product attention (SDPA) operation.

Overview

Use this descriptor with MPSGraph.ScaledDotProductAttentionWithQueryTensorKeyTensorValueTensorDescriptorName to specify optional features such as an attention mask, causal masking, and attention sinks.

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphSDPADescriptor

func MPSGraphSDPADescriptorFromID

func MPSGraphSDPADescriptorFromID(id objc.ID) MPSGraphSDPADescriptor

MPSGraphSDPADescriptorFromID constructs a MPSGraphSDPADescriptor from an objc.ID.

A descriptor that configures a scaled dot product attention (SDPA) operation.

func NewGraphSDPADescriptorWithScale

func NewGraphSDPADescriptorWithScale(scale float32) MPSGraphSDPADescriptor

Creates a descriptor with the given scale and all other properties set to their defaults (no mask, isCausal = NO, no sinks).

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphSDPADescriptor/init(scale:)

func NewMPSGraphSDPADescriptor

func NewMPSGraphSDPADescriptor() MPSGraphSDPADescriptor

NewMPSGraphSDPADescriptor creates a new MPSGraphSDPADescriptor instance.

func (MPSGraphSDPADescriptor) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphSDPADescriptor) Init

Init initializes the instance.

func (MPSGraphSDPADescriptor) IsCausal

func (g MPSGraphSDPADescriptor) IsCausal() bool

When YES, a causal (lower-triangular) mask is applied so that each query position attends only to key positions at or before it. Mutually exclusive with MPSGraphSDPADescriptor.MaskTensor.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphSDPADescriptor/isCausal

func (MPSGraphSDPADescriptor) MaskTensor

func (g MPSGraphSDPADescriptor) MaskTensor() IMPSGraphTensor

An optional additive mask tensor applied to the scaled QK^T scores before softmax. Must be broadcast-compatible with shape `[batch, heads, T_q, T_kv]`. Mutually exclusive with MPSGraphSDPADescriptor.IsCausal.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphSDPADescriptor/maskTensor

func (MPSGraphSDPADescriptor) Scale

func (g MPSGraphSDPADescriptor) Scale() float32

The scale applied to the result of the query–key matrix multiply before softmax. Typically set to `1/sqrt(headDimension)`.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphSDPADescriptor/scale

func (MPSGraphSDPADescriptor) SetIsCausal

func (g MPSGraphSDPADescriptor) SetIsCausal(value bool)

func (MPSGraphSDPADescriptor) SetMaskTensor

func (g MPSGraphSDPADescriptor) SetMaskTensor(value IMPSGraphTensor)

func (MPSGraphSDPADescriptor) SetScale

func (g MPSGraphSDPADescriptor) SetScale(value float32)

func (MPSGraphSDPADescriptor) SetSinksTensor

func (g MPSGraphSDPADescriptor) SetSinksTensor(value IMPSGraphTensor)

func (MPSGraphSDPADescriptor) SinksTensor

func (g MPSGraphSDPADescriptor) SinksTensor() IMPSGraphTensor

An optional attention-sinks tensor of shape `[nHeads]`. Each element seeds the online-softmax accumulator for the corresponding query head with a virtual token logit, causing real-token attention weights to sum to less than one.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphSDPADescriptor/sinksTensor

type MPSGraphSDPADescriptorClass

type MPSGraphSDPADescriptorClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphSDPADescriptorClass

func GetMPSGraphSDPADescriptorClass() MPSGraphSDPADescriptorClass

GetMPSGraphSDPADescriptorClass returns the class object for MPSGraphSDPADescriptor.

func (MPSGraphSDPADescriptorClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphSDPADescriptorClass) Class

Class returns the underlying Objective-C class pointer.

type MPSGraphScatterMode

type MPSGraphScatterMode int

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphScatterMode

const (
	// MPSGraphScatterModeAdd: Add
	MPSGraphScatterModeAdd MPSGraphScatterMode = 0
	// MPSGraphScatterModeDiv: Divide
	MPSGraphScatterModeDiv MPSGraphScatterMode = 3
	// MPSGraphScatterModeMax: Maximum
	MPSGraphScatterModeMax MPSGraphScatterMode = 5
	// MPSGraphScatterModeMin: Minimum
	MPSGraphScatterModeMin MPSGraphScatterMode = 4
	// MPSGraphScatterModeMul: Multiply
	MPSGraphScatterModeMul MPSGraphScatterMode = 2
	// MPSGraphScatterModeSet: Set
	MPSGraphScatterModeSet MPSGraphScatterMode = 6
	// MPSGraphScatterModeSub: Sub
	MPSGraphScatterModeSub MPSGraphScatterMode = 1
)

func (MPSGraphScatterMode) String

func (e MPSGraphScatterMode) String() string

type MPSGraphScheduledHandler

type MPSGraphScheduledHandler = func(resultsDictionary foundation.INSDictionary, error_ foundation.NSError)

MPSGraphScheduledHandler is a notification that appears when graph execution schedules.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphScheduledHandler

type MPSGraphShapedType

type MPSGraphShapedType struct {
	MPSGraphType
}

The shaped type class for types on tensors with a shape and data type.

Initializers

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphShapedType

func MPSGraphShapedTypeFromID

func MPSGraphShapedTypeFromID(id objc.ID) MPSGraphShapedType

MPSGraphShapedTypeFromID constructs a MPSGraphShapedType from an objc.ID.

The shaped type class for types on tensors with a shape and data type.

func NewGraphShapedTypeWithShapeDataType

func NewGraphShapedTypeWithShapeDataType(shape foundation.NSArray, dataType uint32) MPSGraphShapedType

Initializes a shaped type.

shape: The shape of the shaped type.

dataType: The dataType of the shaped type.

Return Value

A valid MPSGraphShapedType, or nil if allocation failure.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphShapedType/init(shape:dataType:)

func NewMPSGraphShapedType

func NewMPSGraphShapedType() MPSGraphShapedType

NewMPSGraphShapedType creates a new MPSGraphShapedType instance.

func (MPSGraphShapedType) Autorelease

func (g MPSGraphShapedType) Autorelease() MPSGraphShapedType

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphShapedType) DataType

func (g MPSGraphShapedType) DataType() uint32

The data type of the shaped type.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphShapedType/dataType

func (MPSGraphShapedType) Init

Init initializes the instance.

func (MPSGraphShapedType) InitWithShapeDataType

func (g MPSGraphShapedType) InitWithShapeDataType(shape foundation.NSArray, dataType uint32) MPSGraphShapedType

Initializes a shaped type.

shape: The shape of the shaped type.

dataType: The dataType of the shaped type.

Return Value

A valid MPSGraphShapedType, or nil if allocation failure.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphShapedType/init(shape:dataType:)

func (MPSGraphShapedType) SetDataType

func (g MPSGraphShapedType) SetDataType(value uint32)

func (MPSGraphShapedType) SetShape

func (g MPSGraphShapedType) SetShape(value foundation.NSArray)

type MPSGraphShapedTypeClass

type MPSGraphShapedTypeClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphShapedTypeClass

func GetMPSGraphShapedTypeClass() MPSGraphShapedTypeClass

GetMPSGraphShapedTypeClass returns the class object for MPSGraphShapedType.

func (MPSGraphShapedTypeClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphShapedTypeClass) Class

func (mc MPSGraphShapedTypeClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type MPSGraphSingleGateRNNDescriptor

type MPSGraphSingleGateRNNDescriptor struct {
	MPSGraphObject
}

The class that defines the parameters for a single gate RNN operation.

Overview

Use this descriptor with the following MPSGraph methods:

- MPSGraph.SingleGateRNNWithSourceTensorRecurrentWeightInitStateDescriptorName - MPSGraph.SingleGateRNNWithSourceTensorRecurrentWeightInputWeightBiasInitStateDescriptorName - MPSGraph.SingleGateRNNWithSourceTensorRecurrentWeightInputWeightBiasInitStateMaskDescriptorName - MPSGraph.SingleGateRNNGradientsWithSourceTensorRecurrentWeightSourceGradientZStateInitStateDescriptorName - MPSGraph.SingleGateRNNGradientsWithSourceTensorRecurrentWeightSourceGradientZStateInputWeightBiasInitStateDescriptorName - MPSGraph.SingleGateRNNGradientsWithSourceTensorRecurrentWeightSourceGradientZStateInputWeightBiasInitStateMaskDescriptorName - MPSGraph.SingleGateRNNGradientsWithSourceTensorRecurrentWeightSourceGradientZStateStateGradientInputWeightBiasInitStateMaskDescriptorName

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphSingleGateRNNDescriptor

func MPSGraphSingleGateRNNDescriptorFromID

func MPSGraphSingleGateRNNDescriptorFromID(id objc.ID) MPSGraphSingleGateRNNDescriptor

MPSGraphSingleGateRNNDescriptorFromID constructs a MPSGraphSingleGateRNNDescriptor from an objc.ID.

The class that defines the parameters for a single gate RNN operation.

func NewMPSGraphSingleGateRNNDescriptor

func NewMPSGraphSingleGateRNNDescriptor() MPSGraphSingleGateRNNDescriptor

NewMPSGraphSingleGateRNNDescriptor creates a new MPSGraphSingleGateRNNDescriptor instance.

func (MPSGraphSingleGateRNNDescriptor) Activation

A parameter that defines the activation function to use with the RNN operation.

Discussion

Default value: MPSGraphRNNActivationRelu.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphSingleGateRNNDescriptor/activation

func (MPSGraphSingleGateRNNDescriptor) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphSingleGateRNNDescriptor) Bidirectional

func (g MPSGraphSingleGateRNNDescriptor) Bidirectional() bool

A parameter that defines a bidirectional RNN layer.

Discussion

If set to [YES] then the input sequence is traversed in both directions and the two results are concatenated together on the channel-axis. Default value: [NO].

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphSingleGateRNNDescriptor/bidirectional

func (MPSGraphSingleGateRNNDescriptor) Init

Init initializes the instance.

func (MPSGraphSingleGateRNNDescriptor) Reverse

A parameter that defines time direction of the input sequence.

Discussion

If set to [YES] then the input sequence is passed in reverse time order to the layer. Note: Ignored when `bidirectional = YES`. Default value: [NO].

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphSingleGateRNNDescriptor/reverse

func (MPSGraphSingleGateRNNDescriptor) SetActivation

func (MPSGraphSingleGateRNNDescriptor) SetBidirectional

func (g MPSGraphSingleGateRNNDescriptor) SetBidirectional(value bool)

func (MPSGraphSingleGateRNNDescriptor) SetReverse

func (g MPSGraphSingleGateRNNDescriptor) SetReverse(value bool)

func (MPSGraphSingleGateRNNDescriptor) SetTraining

func (g MPSGraphSingleGateRNNDescriptor) SetTraining(value bool)

func (MPSGraphSingleGateRNNDescriptor) Training

A parameter that makes the RNN layer support training.

Discussion

If set to [YES] then the layer will produce training state tensor as a secondary output. Default value: [NO].

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphSingleGateRNNDescriptor/training

type MPSGraphSingleGateRNNDescriptorClass

type MPSGraphSingleGateRNNDescriptorClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphSingleGateRNNDescriptorClass

func GetMPSGraphSingleGateRNNDescriptorClass() MPSGraphSingleGateRNNDescriptorClass

GetMPSGraphSingleGateRNNDescriptorClass returns the class object for MPSGraphSingleGateRNNDescriptor.

func (MPSGraphSingleGateRNNDescriptorClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphSingleGateRNNDescriptorClass) Class

Class returns the underlying Objective-C class pointer.

func (MPSGraphSingleGateRNNDescriptorClass) Descriptor

func (_MPSGraphSingleGateRNNDescriptorClass MPSGraphSingleGateRNNDescriptorClass) Descriptor() MPSGraphSingleGateRNNDescriptor

Creates a single gate RNN descriptor with default values.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphSingleGateRNNDescriptor/descriptor

type MPSGraphSparseStorageType

type MPSGraphSparseStorageType uint64

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphSparseStorageType

const (
	// MPSGraphSparseStorageCOO: COO Storage
	MPSGraphSparseStorageCOO MPSGraphSparseStorageType = 0
	// MPSGraphSparseStorageCSC: CSC Storage
	MPSGraphSparseStorageCSC MPSGraphSparseStorageType = 1
	// MPSGraphSparseStorageCSR: CSR Storage
	MPSGraphSparseStorageCSR MPSGraphSparseStorageType = 2
)

func (MPSGraphSparseStorageType) String

func (e MPSGraphSparseStorageType) String() string

type MPSGraphStencilOpDescriptor

type MPSGraphStencilOpDescriptor struct {
	MPSGraphObject
}

The class that defines the parameters for a stencil operation.

Overview

Use this descriptor with the following MPSGraph method:

- MPSGraph.StencilWithSourceTensorWeightsTensorDescriptorName

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphStencilOpDescriptor

func MPSGraphStencilOpDescriptorFromID

func MPSGraphStencilOpDescriptorFromID(id objc.ID) MPSGraphStencilOpDescriptor

MPSGraphStencilOpDescriptorFromID constructs a MPSGraphStencilOpDescriptor from an objc.ID.

The class that defines the parameters for a stencil operation.

func NewGraphStencilOpDescriptorWithExplicitPadding

func NewGraphStencilOpDescriptorWithExplicitPadding(explicitPadding foundation.NSArray) MPSGraphStencilOpDescriptor

Creates a stencil operation descriptor with default values.

explicitPadding: See `explicitPadding` property.

Return Value

A valid MPSGraphStencilOpDescriptor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphStencilOpDescriptor/init(explicitPadding:)

func NewGraphStencilOpDescriptorWithOffsetsExplicitPadding

func NewGraphStencilOpDescriptorWithOffsetsExplicitPadding(offsets foundation.NSArray, explicitPadding foundation.NSArray) MPSGraphStencilOpDescriptor

Creates a stencil operation descriptor with default values.

offsets: See `offsets` property.

explicitPadding: See `explicitPadding` property.

Return Value

A valid MPSGraphStencilOpDescriptor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphStencilOpDescriptor/init(offsets:explicitPadding:)

func NewGraphStencilOpDescriptorWithPaddingStyle

func NewGraphStencilOpDescriptorWithPaddingStyle(paddingStyle MPSGraphPaddingStyle) MPSGraphStencilOpDescriptor

Creates a stencil operation descriptor with default values.

paddingStyle: See `paddingStyle` property.

Return Value

A valid MPSGraphStencilOpDescriptor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphStencilOpDescriptor/init(paddingStyle:)

func NewGraphStencilOpDescriptorWithReductionModeOffsetsStridesDilationRatesExplicitPaddingBoundaryModePaddingStylePaddingConstant

func NewGraphStencilOpDescriptorWithReductionModeOffsetsStridesDilationRatesExplicitPaddingBoundaryModePaddingStylePaddingConstant(reductionMode MPSGraphReductionMode, offsets foundation.NSArray, strides foundation.NSArray, dilationRates foundation.NSArray, explicitPadding foundation.NSArray, boundaryMode MPSGraphPaddingMode, paddingStyle MPSGraphPaddingStyle, paddingConstant float32) MPSGraphStencilOpDescriptor

Creates a stencil operation descriptor with given values.

reductionMode: See `reductionMode` property.

offsets: See `offsets` property.

strides: See `strides` property.

dilationRates: See `dilationRates` property.

explicitPadding: See `explicitPadding` property.

boundaryMode: See `boundaryMode` property.

paddingStyle: See `paddingStyle` property.

paddingConstant: See `paddingConstant` property.

Return Value

A valid MPSGraphStencilOpDescriptor object

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphStencilOpDescriptor/init(reductionMode:offsets:strides:dilationRates:explicitPadding:boundaryMode:paddingStyle:paddingConstant:)

func NewMPSGraphStencilOpDescriptor

func NewMPSGraphStencilOpDescriptor() MPSGraphStencilOpDescriptor

NewMPSGraphStencilOpDescriptor creates a new MPSGraphStencilOpDescriptor instance.

func (MPSGraphStencilOpDescriptor) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphStencilOpDescriptor) BoundaryMode

The property that determines which values to use for padding the input tensor.

Discussion

Default value: MPSGraphPaddingModeZero.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphStencilOpDescriptor/boundaryMode

func (MPSGraphStencilOpDescriptor) DilationRates

The property that defines dilation rates for spatial dimensions.

Discussion

Must be four numbers, one for each spatial dimension, fastest running index last. Default value: `@[ @1, @1, @1, @1 ]`

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphStencilOpDescriptor/dilationRates

func (MPSGraphStencilOpDescriptor) ExplicitPadding

func (g MPSGraphStencilOpDescriptor) ExplicitPadding() foundation.NSArray

The property that defines padding values for spatial dimensions.

Discussion

Must be eight numbers, two for each spatial dimension. For example `paddingValues[0]` defines the explicit padding amount before the first spatial dimension (slowest running index of spatial dimensions), `paddingValues[1]` defines the padding amount after the first spatial dimension etc. Used only when `paddingStyle = MPSGraphPaddingStyleExplicit`. Default value: `@[ @0, @0, @0, @0, @0, @0, @0, @0 ]`

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphStencilOpDescriptor/explicitPadding

func (MPSGraphStencilOpDescriptor) Init

Init initializes the instance.

func (MPSGraphStencilOpDescriptor) Offsets

An array of length four that determines from which offset to start reading the input tensor.

Discussion

Only used when `paddingStyle` is MPSGraphPaddingStyleExplicitOffset. For example zero offset means that the first stencil window will align its top-left corner (in 4 dimensions) to the top-left corner of the input tensor. Default value: `@[ @0, @0, @0, @0 ]`

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphStencilOpDescriptor/offsets

func (MPSGraphStencilOpDescriptor) PaddingConstant

func (g MPSGraphStencilOpDescriptor) PaddingConstant() float32

The padding value for `boundaryMode = MPSGraphPaddingModeConstant`.

Discussion

Default value: 0.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphStencilOpDescriptor/paddingConstant

func (MPSGraphStencilOpDescriptor) PaddingStyle

The property that defines what kind of padding to apply to the stencil operation.

Discussion

Default value: MPSGraphPaddingStyleExplicit.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphStencilOpDescriptor/paddingStyle

func (MPSGraphStencilOpDescriptor) ReductionMode

The reduction mode to use within the stencil window.

Discussion

Default value: MPSGraphReductionModeSum.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphStencilOpDescriptor/reductionMode

func (MPSGraphStencilOpDescriptor) SetBoundaryMode

func (g MPSGraphStencilOpDescriptor) SetBoundaryMode(value MPSGraphPaddingMode)

func (MPSGraphStencilOpDescriptor) SetDilationRates

func (g MPSGraphStencilOpDescriptor) SetDilationRates(value foundation.NSArray)

func (MPSGraphStencilOpDescriptor) SetExplicitPadding

func (g MPSGraphStencilOpDescriptor) SetExplicitPadding(value foundation.NSArray)

func (MPSGraphStencilOpDescriptor) SetOffsets

func (g MPSGraphStencilOpDescriptor) SetOffsets(value foundation.NSArray)

func (MPSGraphStencilOpDescriptor) SetPaddingConstant

func (g MPSGraphStencilOpDescriptor) SetPaddingConstant(value float32)

func (MPSGraphStencilOpDescriptor) SetPaddingStyle

func (g MPSGraphStencilOpDescriptor) SetPaddingStyle(value MPSGraphPaddingStyle)

func (MPSGraphStencilOpDescriptor) SetReductionMode

func (g MPSGraphStencilOpDescriptor) SetReductionMode(value MPSGraphReductionMode)

func (MPSGraphStencilOpDescriptor) SetStrides

func (g MPSGraphStencilOpDescriptor) SetStrides(value foundation.NSArray)

func (MPSGraphStencilOpDescriptor) Strides

The property that defines strides for spatial dimensions.

Discussion

Must be four numbers, one for each spatial dimension, fastest running index last. Default value: `@[ @1, @1, @1, @1 ]`

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphStencilOpDescriptor/strides

type MPSGraphStencilOpDescriptorClass

type MPSGraphStencilOpDescriptorClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphStencilOpDescriptorClass

func GetMPSGraphStencilOpDescriptorClass() MPSGraphStencilOpDescriptorClass

GetMPSGraphStencilOpDescriptorClass returns the class object for MPSGraphStencilOpDescriptor.

func (MPSGraphStencilOpDescriptorClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphStencilOpDescriptorClass) Class

Class returns the underlying Objective-C class pointer.

type MPSGraphTensor

type MPSGraphTensor struct {
	MPSGraphObject
}

The symbolic representation of a compute data type.

Overview

[NSCopy] will take a refrence, this is so [NSDictionary] can work with the tensor. All tensors are created, owned and destroyed by the MPSGraph

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensor

func MPSGraphTensorFromID

func MPSGraphTensorFromID(id objc.ID) MPSGraphTensor

MPSGraphTensorFromID constructs a MPSGraphTensor from an objc.ID.

The symbolic representation of a compute data type.

func NewMPSGraphTensor

func NewMPSGraphTensor() MPSGraphTensor

NewMPSGraphTensor creates a new MPSGraphTensor instance.

func (MPSGraphTensor) Autorelease

func (g MPSGraphTensor) Autorelease() MPSGraphTensor

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphTensor) Init

func (g MPSGraphTensor) Init() MPSGraphTensor

Init initializes the instance.

func (MPSGraphTensor) Operation

func (g MPSGraphTensor) Operation() IMPSGraphOperation

The operation responsible for creating this tensor.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensor/operation

func (MPSGraphTensor) Shape

func (g MPSGraphTensor) Shape() foundation.NSArray

The shape of the tensor.

Discussion

Nil shape represents an unranked tensor. -1 value for a dimension represents that it will be resolved via shape inference at runtime and it can be anything.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensor/shape

type MPSGraphTensorArrayHandler

type MPSGraphTensorArrayHandler = func(*[]MPSGraphTensor) []MPSGraphTensor

MPSGraphTensorArrayHandler handles `afterBlock`, this will execute after the condition evaluation.

Used by:

  • [MPSGraph.WhileWithInitialInputsBeforeAfterName]

type MPSGraphTensorClass

type MPSGraphTensorClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphTensorClass

func GetMPSGraphTensorClass() MPSGraphTensorClass

GetMPSGraphTensorClass returns the class object for MPSGraphTensor.

func (MPSGraphTensorClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphTensorClass) Class

func (mc MPSGraphTensorClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type MPSGraphTensorData

type MPSGraphTensorData struct {
	MPSGraphObject
}

The representation of a compute data type.

Overview

Pass data to a graph using a tensor data, a reference will be taken to your data and used just in time when the graph is run.

Initializers

Instance Properties

Instance Methods

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorData

func MPSGraphTensorDataFromID

func MPSGraphTensorDataFromID(id objc.ID) MPSGraphTensorData

MPSGraphTensorDataFromID constructs a MPSGraphTensorData from an objc.ID.

The representation of a compute data type.

func NewGraphTensorDataWithDeviceDataShapeDataType

func NewGraphTensorDataWithDeviceDataShapeDataType(device IMPSGraphDevice, data foundation.NSData, shape foundation.NSArray, dataType uint32) MPSGraphTensorData

Initializes the tensor data with an [NSData] on a device.

device: MPSDevice on which the MPSGraphTensorData exists

data: NSData from which to copy the contents

shape: Shape of the output tensor

dataType: dataType of the placeholder tensor

Return Value

A valid MPSGraphTensorData, or nil if allocation failure.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorData/init(device:data:shape:dataType:)

func NewGraphTensorDataWithMPSImageBatch

func NewGraphTensorDataWithMPSImageBatch(imageBatch foundation.NSArray) MPSGraphTensorData

Initializes a tensor data with an MPS image batch.

imageBatch: The device on which the kernel will run, unorm8 and unorm16 images will create a float32 tensorData

Return Value

A valid MPSGraphTensorData, or nil if allocation failure.

Discussion

The dataLayout used will be NHWC, call a transpose or permute to change to a layout of your choice.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorData/init(_:)-511a

func NewGraphTensorDataWithMPSMatrix

func NewGraphTensorDataWithMPSMatrix(matrix *metalperformanceshaders.MPSMatrix) MPSGraphTensorData

Initializes a tensor data with an MPS matrix.

matrix: MPSMatrix to be used within the MPSGraphTensorData

Return Value

A valid MPSGraphTensorData, or nil if allocation failure.

Discussion

The device of the MPSMatrix will be used to get the MPSDevice for this MPSGraphTensorData.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorData/init(_:)-2go2

func NewGraphTensorDataWithMPSMatrixRank

func NewGraphTensorDataWithMPSMatrixRank(matrix *metalperformanceshaders.MPSMatrix, rank uint) MPSGraphTensorData

Initializes a tensor data with an MPS matrix enforcing rank of the result.

matrix: MPSMatrix to be used within the MPSGraphTensorData

rank: The rank of the resulting TensorData tensor. NOTE: must be within { 1, … ,16 }.

Return Value

A valid MPSGraphTensorData of given rank, or nil if allocation failure.

Discussion

The device of the MPSMatrix will be used to get the MPSDevice for this MPSGraphTensorData.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorData/init(_:rank:)-1lnxg

func NewGraphTensorDataWithMPSNDArray

func NewGraphTensorDataWithMPSNDArray(ndarray *metalperformanceshaders.MPSNDArray) MPSGraphTensorData

Initializes an MPSGraphTensorData with an MPS ndarray.

ndarray: MPSNDArray to be used within the MPSGraphTensorData.

Return Value

A valid MPSGraphTensorData, or nil if allocation failure.

Discussion

The device of the MPSNDArray will be used to get the MPSDevice for this MPSGraphTensorData.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorData/init(_:)-4bnfb

func NewGraphTensorDataWithMPSVector

func NewGraphTensorDataWithMPSVector(vector *metalperformanceshaders.MPSVector) MPSGraphTensorData

Initializes a tensor data with an MPS vector.

vector: MPSVector to be used within the MPSGraphTensorData

Return Value

A valid MPSGraphTensorData, or nil if allocation failure.

Discussion

The device of the MPSVector will be used to get the MPSDevice for this MPSGraphTensorData.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorData/init(_:)-9kgoe

func NewGraphTensorDataWithMPSVectorRank

func NewGraphTensorDataWithMPSVectorRank(vector *metalperformanceshaders.MPSVector, rank uint) MPSGraphTensorData

Initializes a tensor data with an MPS vector enforcing rank of the result.

vector: MPSVector to be used within the MPSGraphTensorData

rank: The rank of the resulting TensorData tensor. NOTE: must be within { 1, … ,16 }.

Return Value

A valid MPSGraphTensorData, or nil if allocation failure.

Discussion

The device of the MPSVector will be used to get the MPSDevice for this MPSGraphTensorData.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorData/init(_:rank:)-1e4ks

func NewGraphTensorDataWithMTLBufferShapeDataType

func NewGraphTensorDataWithMTLBufferShapeDataType(buffer metal.MTLBuffer, shape foundation.NSArray, dataType uint32) MPSGraphTensorData

Initializes an tensor data with a metal buffer.

buffer: MTLBuffer to be used within the MPSGraphTensorData

shape: Shape of the output tensor

dataType: dataType of the placeholder tensor

Return Value

A valid MPSGraphTensorData, or nil if allocation failure.

Discussion

The device of the MTLBuffer will be used to get the MPSDevice for this MPSGraphTensorData.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorData/init(_:shape:dataType:)

func NewGraphTensorDataWithMTLBufferShapeDataTypeRowBytes

func NewGraphTensorDataWithMTLBufferShapeDataTypeRowBytes(buffer metal.MTLBuffer, shape foundation.NSArray, dataType uint32, rowBytes uint) MPSGraphTensorData

Initializes an tensor data with a metal buffer.

buffer: MTLBuffer to be used within the MPSGraphTensorData

shape: Shape of the output tensor

dataType: dataType of the placeholder tensor

rowBytes: rowBytes for the fastest moving dimension, must be larger than or equal to sizeOf(dataType)shape[rank - 1] and must be a multiple of sizeOf(dataType)

Return Value

A valid MPSGraphTensorData, or nil if allocation failure.

Discussion

The device of the MTLBuffer will be used to get the MPSDevice for this MPSGraphTensorData.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorData/init(_:shape:dataType:rowBytes:)

func NewGraphTensorDataWithMTLTensor

func NewGraphTensorDataWithMTLTensor(tensor metal.MTLTensor) MPSGraphTensorData

Initializes an MPSGraphTensorData with an MTLTensor.

tensor: MTLTensor to be used within the MPSGraphTensorData

Return Value

A valid MPSGraphTensorData, or nil if allocation failure.

Discussion

The internal storage of the MTLTensor will be aliased. Requires tensor to support MTLTensorUsageMachineLearning.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorData/init(_:)-60j6x

func NewMPSGraphTensorData

func NewMPSGraphTensorData() MPSGraphTensorData

NewMPSGraphTensorData creates a new MPSGraphTensorData instance.

func (MPSGraphTensorData) Autorelease

func (g MPSGraphTensorData) Autorelease() MPSGraphTensorData

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphTensorData) DataType

func (g MPSGraphTensorData) DataType() uint32

The data type of the tensor data.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorData/dataType

func (MPSGraphTensorData) Init

Init initializes the instance.

func (MPSGraphTensorData) InitWithDeviceDataShapeDataType

func (g MPSGraphTensorData) InitWithDeviceDataShapeDataType(device IMPSGraphDevice, data foundation.NSData, shape foundation.NSArray, dataType uint32) MPSGraphTensorData

Initializes the tensor data with an [NSData] on a device.

device: MPSDevice on which the MPSGraphTensorData exists

data: NSData from which to copy the contents

shape: Shape of the output tensor

dataType: dataType of the placeholder tensor

Return Value

A valid MPSGraphTensorData, or nil if allocation failure.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorData/init(device:data:shape:dataType:)

func (MPSGraphTensorData) InitWithMPSImageBatch

func (g MPSGraphTensorData) InitWithMPSImageBatch(imageBatch foundation.NSArray) MPSGraphTensorData

Initializes a tensor data with an MPS image batch.

imageBatch: The device on which the kernel will run, unorm8 and unorm16 images will create a float32 tensorData

Return Value

A valid MPSGraphTensorData, or nil if allocation failure.

Discussion

The dataLayout used will be NHWC, call a transpose or permute to change to a layout of your choice.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorData/init(_:)-511a

func (MPSGraphTensorData) InitWithMPSMatrix

Initializes a tensor data with an MPS matrix.

matrix: MPSMatrix to be used within the MPSGraphTensorData

Return Value

A valid MPSGraphTensorData, or nil if allocation failure.

Discussion

The device of the MPSMatrix will be used to get the MPSDevice for this MPSGraphTensorData.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorData/init(_:)-2go2

func (MPSGraphTensorData) InitWithMPSMatrixRank

func (g MPSGraphTensorData) InitWithMPSMatrixRank(matrix *metalperformanceshaders.MPSMatrix, rank uint) MPSGraphTensorData

Initializes a tensor data with an MPS matrix enforcing rank of the result.

matrix: MPSMatrix to be used within the MPSGraphTensorData

rank: The rank of the resulting TensorData tensor. NOTE: must be within { 1, … ,16 }.

Return Value

A valid MPSGraphTensorData of given rank, or nil if allocation failure.

Discussion

The device of the MPSMatrix will be used to get the MPSDevice for this MPSGraphTensorData.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorData/init(_:rank:)-1lnxg

func (MPSGraphTensorData) InitWithMPSNDArray

Initializes an MPSGraphTensorData with an MPS ndarray.

ndarray: MPSNDArray to be used within the MPSGraphTensorData.

Return Value

A valid MPSGraphTensorData, or nil if allocation failure.

Discussion

The device of the MPSNDArray will be used to get the MPSDevice for this MPSGraphTensorData.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorData/init(_:)-4bnfb

func (MPSGraphTensorData) InitWithMPSVector

Initializes a tensor data with an MPS vector.

vector: MPSVector to be used within the MPSGraphTensorData

Return Value

A valid MPSGraphTensorData, or nil if allocation failure.

Discussion

The device of the MPSVector will be used to get the MPSDevice for this MPSGraphTensorData.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorData/init(_:)-9kgoe

func (MPSGraphTensorData) InitWithMPSVectorRank

func (g MPSGraphTensorData) InitWithMPSVectorRank(vector *metalperformanceshaders.MPSVector, rank uint) MPSGraphTensorData

Initializes a tensor data with an MPS vector enforcing rank of the result.

vector: MPSVector to be used within the MPSGraphTensorData

rank: The rank of the resulting TensorData tensor. NOTE: must be within { 1, … ,16 }.

Return Value

A valid MPSGraphTensorData, or nil if allocation failure.

Discussion

The device of the MPSVector will be used to get the MPSDevice for this MPSGraphTensorData.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorData/init(_:rank:)-1e4ks

func (MPSGraphTensorData) InitWithMTLBufferShapeDataType

func (g MPSGraphTensorData) InitWithMTLBufferShapeDataType(buffer metal.MTLBuffer, shape foundation.NSArray, dataType uint32) MPSGraphTensorData

Initializes an tensor data with a metal buffer.

buffer: MTLBuffer to be used within the MPSGraphTensorData

shape: Shape of the output tensor

dataType: dataType of the placeholder tensor

Return Value

A valid MPSGraphTensorData, or nil if allocation failure.

Discussion

The device of the MTLBuffer will be used to get the MPSDevice for this MPSGraphTensorData.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorData/init(_:shape:dataType:)

func (MPSGraphTensorData) InitWithMTLBufferShapeDataTypeRowBytes

func (g MPSGraphTensorData) InitWithMTLBufferShapeDataTypeRowBytes(buffer metal.MTLBuffer, shape foundation.NSArray, dataType uint32, rowBytes uint) MPSGraphTensorData

Initializes an tensor data with a metal buffer.

buffer: MTLBuffer to be used within the MPSGraphTensorData

shape: Shape of the output tensor

dataType: dataType of the placeholder tensor

rowBytes: rowBytes for the fastest moving dimension, must be larger than or equal to sizeOf(dataType)shape[rank - 1] and must be a multiple of sizeOf(dataType)

Return Value

A valid MPSGraphTensorData, or nil if allocation failure.

Discussion

The device of the MTLBuffer will be used to get the MPSDevice for this MPSGraphTensorData.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorData/init(_:shape:dataType:rowBytes:)

func (MPSGraphTensorData) InitWithMTLTensor

func (g MPSGraphTensorData) InitWithMTLTensor(tensor metal.MTLTensor) MPSGraphTensorData

Initializes an MPSGraphTensorData with an MTLTensor.

tensor: MTLTensor to be used within the MPSGraphTensorData

Return Value

A valid MPSGraphTensorData, or nil if allocation failure.

Discussion

The internal storage of the MTLTensor will be aliased. Requires tensor to support MTLTensorUsageMachineLearning.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorData/init(_:)-60j6x

func (MPSGraphTensorData) Mpsndarray

Return an mpsndarray object will copy contents if the contents are not stored in an MPS ndarray.

Return Value

A valid MPSNDArray, or nil if allocation fails.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorData/mpsndarray()

type MPSGraphTensorDataArrayErrorHandler

type MPSGraphTensorDataArrayErrorHandler = func(*[]MPSGraphTensorData, error)

MPSGraphTensorDataArrayErrorHandler is the signature for a completion handler block.

type MPSGraphTensorDataClass

type MPSGraphTensorDataClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphTensorDataClass

func GetMPSGraphTensorDataClass() MPSGraphTensorDataClass

GetMPSGraphTensorDataClass returns the class object for MPSGraphTensorData.

func (MPSGraphTensorDataClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphTensorDataClass) Class

func (mc MPSGraphTensorDataClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type MPSGraphTensorDataDictionary

type MPSGraphTensorDataDictionary = foundation.INSDictionary

MPSGraphTensorDataDictionary is a dictionary of tensors and corresponding tensor data.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorDataDictionary

type MPSGraphTensorMPSGraphTensorArrayHandler

type MPSGraphTensorMPSGraphTensorArrayHandler = func(*MPSGraphTensor, *[]MPSGraphTensor) []MPSGraphTensor

MPSGraphTensorMPSGraphTensorArrayHandler handles This block will execute the body of the for loop.

Used by:

  • [MPSGraph.ForLoopWithLowerBoundUpperBoundStepInitialBodyArgumentsBodyName]
  • [MPSGraph.ForLoopWithNumberOfIterationsInitialBodyArgumentsBodyName]

type MPSGraphTensorMPSGraphTensorDataDictionaryErrorHandler

type MPSGraphTensorMPSGraphTensorDataDictionaryErrorHandler = func(*foundation.INSDictionary, error)

MPSGraphTensorMPSGraphTensorDataDictionaryErrorHandler is the signature for a completion handler block.

type MPSGraphTensorNamedDataLayout

type MPSGraphTensorNamedDataLayout uint

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorNamedDataLayout

const (
	// MPSGraphTensorNamedDataLayoutCHW: LayoutCHW
	MPSGraphTensorNamedDataLayoutCHW MPSGraphTensorNamedDataLayout = 4
	// MPSGraphTensorNamedDataLayoutDHWIO: LayoutDHWIO
	MPSGraphTensorNamedDataLayoutDHWIO MPSGraphTensorNamedDataLayout = 10
	// MPSGraphTensorNamedDataLayoutHW: LayoutHW
	MPSGraphTensorNamedDataLayoutHW MPSGraphTensorNamedDataLayout = 6
	// MPSGraphTensorNamedDataLayoutHWC: LayoutHWC
	MPSGraphTensorNamedDataLayoutHWC MPSGraphTensorNamedDataLayout = 5
	// MPSGraphTensorNamedDataLayoutHWIO: LayoutHWIO
	MPSGraphTensorNamedDataLayoutHWIO MPSGraphTensorNamedDataLayout = 3
	// MPSGraphTensorNamedDataLayoutNCDHW: LayoutNCDHW
	MPSGraphTensorNamedDataLayoutNCDHW MPSGraphTensorNamedDataLayout = 7
	// MPSGraphTensorNamedDataLayoutNCHW: LayoutNCHW
	MPSGraphTensorNamedDataLayoutNCHW MPSGraphTensorNamedDataLayout = 0
	// MPSGraphTensorNamedDataLayoutNDHWC: LayoutNDHWC
	MPSGraphTensorNamedDataLayoutNDHWC MPSGraphTensorNamedDataLayout = 8
	// MPSGraphTensorNamedDataLayoutNHWC: LayoutNHWC
	MPSGraphTensorNamedDataLayoutNHWC MPSGraphTensorNamedDataLayout = 1
	// MPSGraphTensorNamedDataLayoutOIDHW: LayoutOIDHW
	MPSGraphTensorNamedDataLayoutOIDHW MPSGraphTensorNamedDataLayout = 9
	// MPSGraphTensorNamedDataLayoutOIHW: LayoutOIHW
	MPSGraphTensorNamedDataLayoutOIHW MPSGraphTensorNamedDataLayout = 2
)

func (MPSGraphTensorNamedDataLayout) String

type MPSGraphTensorShapedTypeDictionary

type MPSGraphTensorShapedTypeDictionary = foundation.INSDictionary

MPSGraphTensorShapedTypeDictionary is a dictionary of tensors and corresponding shapes for them.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphTensorShapedTypeDictionary

type MPSGraphTensorVoidHandler

type MPSGraphTensorVoidHandler = func() []MPSGraphTensor

MPSGraphTensorVoidHandler handles MPSGraphControlFlowDependencyBlock which is provided by caller to create dependent ops

Used by:

  • [MPSGraph.ControlDependencyWithOperationsDependentBlockName]
  • [MPSGraph.IfWithPredicateTensorThenBlockElseBlockName]
  • [MPSGraph.WhileWithInitialInputsBeforeAfterName]

type MPSGraphType

type MPSGraphType struct {
	MPSGraphObject
}

The base type class for types on tensors.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphType

func MPSGraphTypeFromID

func MPSGraphTypeFromID(id objc.ID) MPSGraphType

MPSGraphTypeFromID constructs a MPSGraphType from an objc.ID.

The base type class for types on tensors.

func NewMPSGraphType

func NewMPSGraphType() MPSGraphType

NewMPSGraphType creates a new MPSGraphType instance.

func (MPSGraphType) Autorelease

func (g MPSGraphType) Autorelease() MPSGraphType

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphType) Init

func (g MPSGraphType) Init() MPSGraphType

Init initializes the instance.

type MPSGraphTypeClass

type MPSGraphTypeClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphTypeClass

func GetMPSGraphTypeClass() MPSGraphTypeClass

GetMPSGraphTypeClass returns the class object for MPSGraphType.

func (MPSGraphTypeClass) Alloc

func (mc MPSGraphTypeClass) Alloc() MPSGraphType

Alloc allocates memory for a new instance of the class.

func (MPSGraphTypeClass) Class

func (mc MPSGraphTypeClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type MPSGraphVariableOp

type MPSGraphVariableOp struct {
	MPSGraphOperation
}

The class that defines the parameters for a variable.

Instance Properties

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphVariableOp

func MPSGraphVariableOpFromID

func MPSGraphVariableOpFromID(id objc.ID) MPSGraphVariableOp

MPSGraphVariableOpFromID constructs a MPSGraphVariableOp from an objc.ID.

The class that defines the parameters for a variable.

func NewMPSGraphVariableOp

func NewMPSGraphVariableOp() MPSGraphVariableOp

NewMPSGraphVariableOp creates a new MPSGraphVariableOp instance.

func (MPSGraphVariableOp) Autorelease

func (g MPSGraphVariableOp) Autorelease() MPSGraphVariableOp

Autorelease adds the receiver to the current autorelease pool.

func (MPSGraphVariableOp) DataType

func (g MPSGraphVariableOp) DataType() uint32

The data type of the variable.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphVariableOp/dataType

func (MPSGraphVariableOp) Init

Init initializes the instance.

type MPSGraphVariableOpClass

type MPSGraphVariableOpClass struct {
	// contains filtered or unexported fields
}

func GetMPSGraphVariableOpClass

func GetMPSGraphVariableOpClass() MPSGraphVariableOpClass

GetMPSGraphVariableOpClass returns the class object for MPSGraphVariableOp.

func (MPSGraphVariableOpClass) Alloc

Alloc allocates memory for a new instance of the class.

func (MPSGraphVariableOpClass) Class

func (mc MPSGraphVariableOpClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type MPSGraphWhileAfterBlock

type MPSGraphWhileAfterBlock = func(bodyBlockArguments []MPSGraphTensor) []MPSGraphTensor

MPSGraphWhileAfterBlock is the block that executes after the condition evaluates for each iteration.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphWhileAfterBlock

type MPSGraphWhileBeforeBlock

type MPSGraphWhileBeforeBlock = func(inputTensors []MPSGraphTensor, resultTensors foundation.INSArray) MPSGraphTensor

MPSGraphWhileBeforeBlock is the block that executes before the condition evaluates for each iteration.

See: https://developer.apple.com/documentation/MetalPerformanceShadersGraph/MPSGraphWhileBeforeBlock

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL