Class MPSNDArrayDescriptor

  • All Implemented Interfaces:
    NSObject

    public class MPSNDArrayDescriptor
    extends NSObject
    MPSNDArrayDescriptor [@dependency] This depends on Metal.framework A MPSNDArrayDescriptor object describes a attributes of MPSNDArray and is used to create one (see MPSNDArray discussion below)
    • Constructor Detail

      • MPSNDArrayDescriptor

        protected MPSNDArrayDescriptor​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static java.lang.Object allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(java.lang.Object aTarget,
                                                                                 org.moe.natj.objc.SEL aSelector,
                                                                                 java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        public static org.moe.natj.objc.Class classForKeyedUnarchiver()
      • dataType

        public int dataType()
        Data Type of the MPSNDArray elements
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • descriptorWithDataTypeDimensionCountDimensionSizes

        public static MPSNDArrayDescriptor descriptorWithDataTypeDimensionCountDimensionSizes​(int dataType,
                                                                                              long numberOfDimensions,
                                                                                              org.moe.natj.general.ptr.NUIntPtr dimensionSizes)
        Create an MPSNDArrayDescriptor object for a given size of dimensions. Sample code: [@code] // Creates an NDArrayDescriptor of dimensions [32, 6, 5, 3] NSUInteger sizes[] = {3,5,6,32}; [ MPSNDArray descriptorWithDataType: MPSDataTypeFloat32 dimensionCount: 4 dimensionSizes: sizes ]; // array of numberOfDimensions dimensions. Starts with dimension 0 [@endcode]
        Parameters:
        dataType - MPSDataType of elements in the MPSNDArray
        numberOfDimensions - Number of dimensions in the NDArray. May not exceed 16.
        dimensionSizes - An array of NSUIntegers where dimension lengths provided by the user goes from fastest moving to slowest moving dimension. The product of all dimension lengths must be less than 2**31. Additional system memory limits may apply
        Returns:
        A valid MPSNDArrayDescriptor object or nil, if failure.
      • descriptorWithDataTypeDimensionSizes

        public static MPSNDArrayDescriptor descriptorWithDataTypeDimensionSizes​(int dataType,
                                                                                long dimension0,
                                                                                java.lang.Object... varargs)
        Create an MPSNDArrayDescriptor object for a given size of dimensions. Sample code: [@code] // Creates an NDArrayDescriptor of dimensions [32, 5, 6, 3] [ MPSNDArray descriptorWithDataType: MPSDataTypeFloat32 dimensionSizes: 3, 6, 5, 32, 0 //<--list terminator! ]; // array of numberOfDimensions dimensions. Starts with dimension 0 [@endcode]
        Parameters:
        dataType - MPSDataType of elements in the MPSNDArray
        dimension0 - The start of a 0-terminated variadric list of NSUIntegers where dimension lengths provided by the user goes from fastest moving to slowest moving dimension. The product of all dimension sizes must be less than 2**31. Additional system memory limits may apply
        Returns:
        A valid MPSNDArrayDescriptor object or nil, if failure.
      • descriptorWithDataTypeShape

        public static MPSNDArrayDescriptor descriptorWithDataTypeShape​(int dataType,
                                                                       NSArray<? extends NSNumber> shape)
        A convenience function to create an MPSNDArrayDescriptor object for a given size of dimensions. Sample code: [@code] // Creates an NDArrayDescriptor of dimensions [32, 6, 5, 3] NSArray sizes = {@32,@6,@5,@3}; [ MPSNDArray descriptorWithDataType: MPSDataTypeFloat32 shape: &sizes]; [@endcode]
        Parameters:
        dataType - MPSDataType of elements in the MPSNDArray
        shape - An array of NSUIntegers where dimension lengths provided by the user goes from slowest moving to fastest moving dimension. This is same order as MLMultiArray in coreML and most frameworks in Python The product of all dimension lengths must be less than 2**31. Additional system memory limits may apply
        Returns:
        A valid MPSNDArrayDescriptor object or nil, if failure.
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(java.lang.String key)
      • lengthOfDimension

        public long lengthOfDimension​(long dimensionIndex)
        The number of elements of type dataType in the indicated dimension. If dimensionIndex >= numberOfDimensions, 1 will be returned.
        Parameters:
        dimensionIndex - dimension the MPSNDArray for which to return the length
        Returns:
        The number of elements in that dimension.
      • new_objc

        public static java.lang.Object new_objc()
      • numberOfDimensions

        public long numberOfDimensions()
        The number of dimensions in the NDArray. May not exceed 16. A 0-diumension MPSNDArray is a single scalar value. Undefined dimensions are implicitly length 1.
      • reshapeWithDimensionCountDimensionSizes

        public void reshapeWithDimensionCountDimensionSizes​(long numberOfDimensions,
                                                            org.moe.natj.general.ptr.NUIntPtr dimensionSizes)
        Changes dimension sizes and number of dimensions on the current descriptor
        Parameters:
        numberOfDimensions - Number of dimensions in the NDArray. May not exceed 16.
        dimensionSizes - An array of NSUIntegers where dimension lengths provided by the user goes from fastest moving to slowest moving dimension. The product of all dimension lengths must be less than 2**31. Additional system memory limits may apply
      • reshapeWithShape

        public void reshapeWithShape​(NSArray<? extends NSNumber> shape)
        Changes dimension sizes and number of dimensions on the current descriptor
        Parameters:
        shape - An array of NSUIntegers where dimension lengths provided by the user goes from slowest moving to fastest moving dimension. This is same order as MLMultiArray in coreML and most frameworks in Python The product of all dimension lengths must be less than 2**31. Additional system memory limits may apply
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setDataType

        public void setDataType​(int value)
        Data Type of the MPSNDArray elements
      • setNumberOfDimensions

        public void setNumberOfDimensions​(long value)
        The number of dimensions in the NDArray. May not exceed 16. A 0-diumension MPSNDArray is a single scalar value. Undefined dimensions are implicitly length 1.
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • sliceDimensionWithSubrange

        public void sliceDimensionWithSubrange​(long dimensionIndex,
                                               MPSDimensionSlice subRange)
        The slice dimensions for each dimension [@discusion] A slice is a subregion of a dimension. It is used to calve off a fraction of a larger NDArray. Default: NSRange(0, lengthOfDimension(i))
        Parameters:
        subRange - The region of the slice, start value is wrt dimensionLength of the NDArray.
        dimensionIndex - The index of the dimension. Must be < numberOfDimensions
      • sliceRangeForDimension

        public MPSDimensionSlice sliceRangeForDimension​(long dimensionIndex)
        The slice dimensions for each dimension [@discusion] A slice is a subregion of a dimension. It is used to calve off a fraction of a larger NDArray.
        Parameters:
        dimensionIndex - The index of the dimension
        Returns:
        Returns the slice range for the index. If the dimensionIndex >= numberOfDimensions, {0,1} is returned.
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • transposeDimensionWithDimension

        public void transposeDimensionWithDimension​(long dimensionIndex,
                                                    long dimensionIndex2)
        transpose two dimensions [@discusion] If the intention is to insert a length 1 dimension, increment the numberOfDimensions first.
        Parameters:
        dimensionIndex - The first dimension. Must be < numberOfDimensions
        dimensionIndex2 - The second dimension. Must be < number of Dimensions.
      • version_static

        public static long version_static()