stencil(withSourceTensor:weightsTensor:descriptor:name:)
Creates a stencil operation and returns the result tensor.
Declaration
func stencil(withSourceTensor source: MPSGraphTensor, weightsTensor weights: MPSGraphTensor, descriptor: MPSGraphStencilOpDescriptor, name: String?) -> MPSGraphTensorParameters
- 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 reductionMode) on the last 4 dimensions of the source over the window determined by weights, according to the value defined in descriptor.
y[i] = reduction{j \in w} ( x[ i + j ]w[j] )