manpagez: man pages & more
man MPSNNDefaultPadding(3)
Home | html | info | man
MPSNNDefaultPadding(3)




NAME

       MPSNNDefaultPadding


SYNOPSIS

       #import <MPSNeuralNetworkTypes.h>

       Inherits NSObject, and <MPSNNPadding>.

   Instance Methods
       (NSString *__nonnull) - label

   Class Methods
       (instancetype __nonnull) + paddingWithMethod:
       (instancetype __nonnull) + paddingForTensorflowAveragePooling


Method Documentation

   - (NSString * __nonnull) label
       Human readable description of what the padding policy does

   + (instancetype __nonnull) paddingForTensorflowAveragePooling
       A padding policy that attempts to reproduce TensorFlow behavior for
       average pooling  Most TensorFlow padding is covered by the standard
       MPSNNPaddingMethod encodings. You can use +paddingWithMethod to get
       quick access to MPSNNPadding objects, when default filter behavior
       isn't enough. (It often is.) However, the edging for max pooling in
       TensorFlow is a bit unusual.

       This padding method attempts to reproduce TensorFlow padding for
       average pooling. In addition to setting MPSNNPaddingMethodSizeSame |
       MPSNNPaddingMethodAlignCentered |
       MPSNNPaddingMethodAddRemainderToTopLeft, it also configures the filter
       to run with MPSImageEdgeModeClamp, which (as a special case for average
       pooling only), normalizes the sum of contributing samples to the area
       of valid contributing pixels only.


       // Sample implementation for the tensorflowPoolingPaddingPolicy returned
        -(MPSNNPaddingMethod) paddingMethod{ return MPSNNPaddingMethodCustom | MPSNNPaddingMethodSizeSame; }

        -(MPSImageDescriptor * __nonnull) destinationImageDescriptorForSourceImages: (NSArray <MPSImage *> *__nonnull) sourceImages
                                                                       sourceStates: (NSArray <MPSState *> * __nullable) sourceStates
                                                                          forKernel: (MPSKernel * __nonnull) kernel
                                                                suggestedDescriptor: (MPSImageDescriptor * __nonnull) inDescriptor
        {

           ((MPSCNNKernel *)kernel).edgeMode = MPSImageEdgeModeClamp;

           return inDescriptor;
        }



   + (instancetype __nonnull) paddingWithMethod: (MPSNNPaddingMethod) method
       Fetch a well known object that implements a non-custom padding method
       For custom padding methods, you will need to implement an object that
       conforms to the full MPSNNPadding protocol, including NSSecureCoding.

       Parameters:
           method A MPSNNPaddingMethod

       Returns:
           An object that implements <MPSNNPadding> for use with
           MPSNNGraphNodes.





Author

       Generated automatically by Doxygen for
       MetalPerformanceShaders.framework from the source code.





Version MetalPerformanceShaders-Thu2Jul 13 2017         MPSNNDefaultPadding(3)


Mac OS X 10.12.6 - Generated Tue Oct 31 15:33:43 CDT 2017
© manpagez.com 2000-2024
Individual documents may contain additional copyright information.