.TH "MPSCNNPoolingAverageGradient" 3 "Mon Jul 9 2018" "Version MetalPerformanceShaders-119.3" "MetalPerformanceShaders.framework" \" -*- nroff -*- .ad l .nh .SH NAME MPSCNNPoolingAverageGradient .SH SYNOPSIS .br .PP .PP \fC#import \fP .PP Inherits \fBMPSCNNPoolingGradient\fP\&. .SS "Instance Methods" .in +1c .ti -1c .RI "(nonnull instancetype) \- \fBinitWithDevice:kernelWidth:kernelHeight:strideInPixelsX:strideInPixelsY:\fP" .br .ti -1c .RI "(nullable instancetype) \- \fBinitWithCoder:device:\fP" .br .in -1c .SS "Properties" .in +1c .ti -1c .RI "NSUInteger \fBzeroPadSizeX\fP" .br .ti -1c .RI "NSUInteger \fBzeroPadSizeY\fP" .br .in -1c .SS "Additional Inherited Members" .SH "Detailed Description" .PP This depends on Metal\&.framework Specifies the filter for computing the gradient of the average pooling filter\&. The operation backpropagates a gradient vector using chain rule\&. .PP Average pooling forward pass is defined as: .PP .nf out(x) = sum_{dx \in Window(x)} in(s*x+dx) / N(x), where .fi .PP .PP the pooling window definition 'Window(x)' follows \fBMPSCNNPooling\fP specification, 'N(x)' is effective pooling window size in pixels as specified in \fBMPSCNNPoolingAverage\fP, 's' is the pixel stride and in() is the source input image\&. .PP Hence the partial derivative of the output value wrt\&. to the input value needed in the gradient backpropagation in \fBMPSCNNPoolingGradient\fP is: .PP .nf d out(x)/d in(y) = sum_{dx \in Window(x)} delta_{s*x+dx, y} / N(x), where .fi .PP .PP delta_{x,y} is the Kronecker delta symbol for which .PP .nf delta_{x,y} = { 1, when x == y { 0, otherwise. .fi .PP .PP In practice this means that the gradient value for the destination image at pixel 'x' is the sum over these contributions coming from all pooling windows that contribute to the average pooling computation in the forward pass, multiplied by the input gradient value in the source area of the corresponding pooling window\&. .PP Note: As average pooling is a linear operation of its inputs, the gradient does not depend at all on the original input values, but the original input image size is needed so that we know the limits where the input values seize to exist to inhibit accumulation of gradient values for those pixels\&. Therefore, as secondary input, any correctly sized image will produce correct results for the gradient backpropagation and hence it is recommended to use a temporary image of correct size (see \fBMPSTemporaryImage\fP) for the secondary source image parameter\&. .SH "Method Documentation" .PP .SS "\- (nullable instancetype) \fBinitWithCoder:\fP (NSCoder *__nonnull) aDecoder(nonnull id< MTLDevice >) device" \fBNSSecureCoding\fP compatability See \fBMPSKernel::initWithCoder\fP\&. .PP \fBParameters:\fP .RS 4 \fIaDecoder\fP The NSCoder subclass with your serialized \fBMPSCNNPoolingAverageGradient\fP .br \fIdevice\fP The MTLDevice on which to make the \fBMPSCNNPoolingAverageGradient\fP .RE .PP \fBReturns:\fP .RS 4 \fBA\fP new \fBMPSCNNPoolingAverageGradient\fP object, or nil if failure\&. .RE .PP .PP Reimplemented from \fBMPSCNNPoolingGradient\fP\&. .SS "\- (nonnull instancetype) \fBinitWithDevice:\fP (nonnull id< MTLDevice >) device(NSUInteger) kernelWidth(NSUInteger) kernelHeight(NSUInteger) strideInPixelsX(NSUInteger) strideInPixelsY" Initialize a gradient average pooling filter .PP \fBParameters:\fP .RS 4 \fIdevice\fP The device the filter will run on .br \fIkernelWidth\fP The width of the kernel\&. Can be an odd or even value\&. .br \fIkernelHeight\fP The height of the kernel\&. Can be an odd or even value\&. .br \fIstrideInPixelsX\fP The input stride (upsampling factor) in the x dimension\&. .br \fIstrideInPixelsY\fP The input stride (upsampling factor) in the y dimension\&. .RE .PP \fBReturns:\fP .RS 4 \fBA\fP valid \fBMPSCNNPoolingGradient\fP object or nil, if failure\&. .RE .PP .PP Reimplemented from \fBMPSCNNPoolingGradient\fP\&. .SH "Property Documentation" .PP .SS "\- zeroPadSizeX\fC [read]\fP, \fC [write]\fP, \fC [nonatomic]\fP, \fC [assign]\fP" How much zero padding to apply to both left and right borders of the input image for average pooling, when using .PP \fBSee also:\fP .RS 4 edgeMode \fBMPSImageEdgeModeClamp\fP\&. For .PP edgeMode \fBMPSImageEdgeModeZero\fP this property is ignored and the area outside the image is interpreted to contain zeros\&. The zero \fBpadding\fP size is used to shrink the pooling window to fit inside the area bound by the source image and its \fBpadding\fP region, but the effect is that the normalization factor of the average computation is computed also for the zeros in the \fBpadding\fP region\&. .RE .PP .SS "\- zeroPadSizeY\fC [read]\fP, \fC [write]\fP, \fC [nonatomic]\fP, \fC [assign]\fP" How much zero padding to apply to both top and bottom borders of the input image for average pooling, when using .PP \fBSee also:\fP .RS 4 edgeMode \fBMPSImageEdgeModeClamp\fP\&. For .PP edgeMode \fBMPSImageEdgeModeZero\fP this property is ignored and the area outside the image is interpreted to contain zeros\&. The zero \fBpadding\fP size is used to shrink the pooling window to fit inside the area bound by the source image and its \fBpadding\fP region, but the effect is that the normalization factor of the average computation is computed also for the zeros in the \fBpadding\fP region\&. .RE .PP .SH "Author" .PP Generated automatically by Doxygen for MetalPerformanceShaders\&.framework from the source code\&.