C# Класс DigitDetection.SlimMPSCnnConvolution

The SlimMPSCNNConvolution is a wrapper class around MPSCNNConvolution used to encapsulate: - making an MPSCNNConvolutionDescriptor, - adding network parameters (weights and bias binaries by memory mapping the binaries) - getting our convolution layer
Наследование: MPSCnnConvolution
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Create ( uint kernelWidth, uint kernelHeight, uint inputFeatureChannels, uint outputFeatureChannels, MPSCnnNeuron neuronFilter, IMTLDevice device, string kernelParamsBinaryName, bool padding, uint strideX, uint strideY, uint destinationFeatureChannelOffset, uint groupNum ) : SlimMPSCnnConvolution

Initializes a fully connected kernel. Returns: A valid SlimMPSCnnConvolution object or null, if failure.

EncodeToCommandBuffer ( IMTLCommandBuffer commandBuffer, MPSImage sourceImage, MPSImage destinationImage ) : void

Encode a MPSCnnKernel into a command Buffer. The operation shall proceed out-of-place. We calculate the appropriate offset as per how TensorFlow calculates its padding using input image size and stride here. This [Link](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/ops/nn.py) has an explanation in header comments how tensorFlow pads its convolution input images.

Приватные методы

Метод Описание
IntPtr_objc_msgSend_IntPtr_IntPtr_IntPtr_IntPtr_UInt64 ( IntPtr receiver, IntPtr selector, IntPtr arg1, IntPtr arg2, IntPtr arg3, IntPtr arg4, ulong arg5 ) : IntPtr
SlimMPSCnnConvolution ( IMTLDevice device, MPSCnnConvolutionDescriptor convolutionDescriptor, IntPtr kernelWeights, IntPtr biasTerms, MPSCnnConvolutionFlags flags ) : System

Описание методов

Create() публичный статический Метод

Initializes a fully connected kernel. Returns: A valid SlimMPSCnnConvolution object or null, if failure.
public static Create ( uint kernelWidth, uint kernelHeight, uint inputFeatureChannels, uint outputFeatureChannels, MPSCnnNeuron neuronFilter, IMTLDevice device, string kernelParamsBinaryName, bool padding, uint strideX, uint strideY, uint destinationFeatureChannelOffset, uint groupNum ) : SlimMPSCnnConvolution
kernelWidth uint Kernel Width
kernelHeight uint Kernel Height
inputFeatureChannels uint Number feature channels in input of this layer
outputFeatureChannels uint Number feature channels from output of this layer
neuronFilter MPSCnnNeuron A neuronFilter to add at the end as activation (could be null)
device IMTLDevice The IMTLDevice on which this SlimMPSCnnConvolution filter will be used
kernelParamsBinaryName string name of the layer to fetch kernelParameters by adding a prefix "weights_" or "bias_"
padding bool Bool value whether to use padding or not
strideX uint Stride of the filter
strideY uint Stride of the filter
destinationFeatureChannelOffset uint FeatureChannel no. in the destination MPSImage to start writing from, helps with concat operations
groupNum uint if grouping is used, default value is 1 meaning no groups
Результат SlimMPSCnnConvolution

EncodeToCommandBuffer() публичный Метод

Encode a MPSCnnKernel into a command Buffer. The operation shall proceed out-of-place. We calculate the appropriate offset as per how TensorFlow calculates its padding using input image size and stride here. This [Link](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/ops/nn.py) has an explanation in header comments how tensorFlow pads its convolution input images.
public EncodeToCommandBuffer ( IMTLCommandBuffer commandBuffer, MPSImage sourceImage, MPSImage destinationImage ) : void
commandBuffer IMTLCommandBuffer A valid MTLCommandBuffer to receive the encoded filter
sourceImage MPSImage A valid MPSImage object containing the source image.
destinationImage MPSImage A valid MPSImage to be overwritten by result image. destinationImage may not alias sourceImage
Результат void