Skip to content

MetalPerformanceShadersGraph tvOS xcode14.3 beta1

Alex Soto edited this page Feb 16, 2023 · 1 revision

#MetalPerformanceShadersGraph.framework

diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphConvolutionOps.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphConvolutionOps.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphConvolutionOps.h	2022-11-10 19:16:14
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphConvolutionOps.h	2023-02-11 22:22:04
@@ -68,6 +68,73 @@
 
 @end
 
+MPS_CLASS_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3))
+@interface MPSGraphConvolution3DOpDescriptor : NSObject<NSCopying>
+
+
+@property (readwrite, nonatomic) NSUInteger strideInX;
+@property (readwrite, nonatomic) NSUInteger strideInY;
+@property (readwrite, nonatomic) NSUInteger strideInZ;
+@property (readwrite, nonatomic) NSUInteger dilationRateInX;
+@property (readwrite, nonatomic) NSUInteger dilationRateInY;
+@property (readwrite, nonatomic) NSUInteger dilationRateInZ;
+
+@property (readwrite, nonatomic) NSUInteger paddingLeft;
+@property (readwrite, nonatomic) NSUInteger paddingRight;
+@property (readwrite, nonatomic) NSUInteger paddingTop;
+@property (readwrite, nonatomic) NSUInteger paddingBottom;
+@property (readwrite, nonatomic) NSUInteger paddingFront;
+@property (readwrite, nonatomic) NSUInteger paddingBack;
+
+@property (readwrite, nonatomic) MPSGraphPaddingStyle paddingStyle;
+@property (readwrite, nonatomic) MPSGraphTensorNamedDataLayout dataLayout;
+@property (readwrite, nonatomic) MPSGraphTensorNamedDataLayout weightsLayout;
+
+/*! @property   groups
+ *  @discussion groups of the operation
+ */
+@property (readwrite, nonatomic) NSUInteger groups;
+
+
++(nullable instancetype) descriptorWithStrideInX:(NSUInteger) strideInX
+                                       strideInY:(NSUInteger) strideInY
+                                       strideInZ:(NSUInteger) strideInZ
+                                 dilationRateInX:(NSUInteger) dilationRateInX
+                                 dilationRateInY:(NSUInteger) dilationRateInY
+                                 dilationRateInZ:(NSUInteger) dilationRateInZ
+                                          groups:(NSUInteger) groups
+                                     paddingLeft:(NSUInteger) paddingLeft
+                                    paddingRight:(NSUInteger) paddingRight
+                                      paddingTop:(NSUInteger) paddingTop
+                                   paddingBottom:(NSUInteger) paddingBottom
+                                    paddingFront:(NSUInteger) paddingFront
+                                     paddingBack:(NSUInteger) paddingBack
+                                    paddingStyle:(MPSGraphPaddingStyle) paddingStyle
+                                      dataLayout:(MPSGraphTensorNamedDataLayout) dataLayout
+                                   weightsLayout:(MPSGraphTensorNamedDataLayout) weightsLayout;
+
++(nullable instancetype) descriptorWithStrideInX:(NSUInteger) strideInX
+                                       strideInY:(NSUInteger) strideInY
+                                       strideInZ:(NSUInteger) strideInZ
+                                 dilationRateInX:(NSUInteger) dilationRateInX
+                                 dilationRateInY:(NSUInteger) dilationRateInY
+                                 dilationRateInZ:(NSUInteger) dilationRateInZ
+                                          groups:(NSUInteger) groups
+                                    paddingStyle:(MPSGraphPaddingStyle) paddingStyle
+                                      dataLayout:(MPSGraphTensorNamedDataLayout) dataLayout
+                                   weightsLayout:(MPSGraphTensorNamedDataLayout) weightsLayout;
+
+
+-(void) setExplicitPaddingWithPaddingLeft:(NSUInteger) paddingLeft
+                             paddingRight:(NSUInteger) paddingRight
+                               paddingTop:(NSUInteger) paddingTop
+                            paddingBottom:(NSUInteger) paddingBottom
+                             paddingFront:(NSUInteger) paddingFront
+                              paddingBack:(NSUInteger) paddingBack;
+
+
+@end
+
 MPS_CLASS_AVAILABLE_STARTING(macos(11.0), ios(14.0), tvos(14.0))
 @interface MPSGraph(MPSGraphConvolutionOps)
 
@@ -160,6 +227,99 @@
                                                                       name:(NSString * _Nullable) name
 MPS_CLASS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0))
 MPS_SWIFT_NAME( convolution2DWeightsGradient(_:source:outputShapeTensor:forwardConvolutionDescriptor:name:) );
+
+
+
+-(MPSGraphTensor *) convolution3DWithSourceTensor:(MPSGraphTensor *) source
+                                    weightsTensor:(MPSGraphTensor *) weights
+                                       descriptor:(MPSGraphConvolution3DOpDescriptor *) descriptor
+                                             name:(NSString * _Nullable) name
+MPS_CLASS_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3))
+MPS_SWIFT_NAME( convolution3D(_:weights:descriptor:name:) );
+
+/*!
+ *  @abstract   Create Convolution 3D gradient op and return the result tensor
+ *  @discussion Computes the gradient of source input for the forward pass Convolution op with identical parameters.
+ *              See discussion of convolution3DWithSourceTensor for more in depth description of  paramters.
+ *
+ *  @param      incomingGradient                              Incoming gradient tensor
+ *  @param      weights                                                  Forward pass weights tensor
+ *  @param      outputShape                                         Shape of the forward pass source tensor
+ *  @param      forwardConvolutionDescriptor   Forward pass op descriptor
+ *  @param      name                                                        The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) convolution3DDataGradientWithIncomingGradientTensor:(MPSGraphTensor *) incomingGradient
+                                                          weightsTensor:(MPSGraphTensor *) weights
+                                                            outputShape:(MPSShape *) outputShape
+                                           forwardConvolutionDescriptor:(MPSGraphConvolution3DOpDescriptor *) forwardConvolutionDescriptor
+                                                                   name:(NSString * _Nullable) name
+MPS_CLASS_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3))
+MPS_SWIFT_NAME( convolution3DDataGradient(_:weights:outputShape:forwardConvolutionDescriptor:name:) );
+
+/*!
+ *  @abstract   Create Convolution 3D gradient op and return the result tensor
+ *  @discussion Computes the gradient of source input for the forward pass Convolution op with identical parameters.
+ *              See discussion of convolution3DWithSourceTensor for more in depth description of  paramters.
+ *
+ *  @param      gradient                                                Incoming gradient tensor
+ *  @param      weights                                                  Forward pass weights tensor
+ *  @param      outputShapeTensor                           1D Int32 or Int64 Tensor. Shape of the forward pass source tensor
+ *  @param      forwardConvolutionDescriptor   Forward pass op descriptor
+ *  @param      name                                                        The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) convolution3DDataGradientWithIncomingGradientTensor:(MPSGraphTensor *) gradient
+                                                          weightsTensor:(MPSGraphTensor *) weights
+                                                      outputShapeTensor:(MPSGraphTensor *) outputShapeTensor
+                                           forwardConvolutionDescriptor:(MPSGraphConvolution3DOpDescriptor *) forwardConvolutionDescriptor
+                                                                   name:(NSString * _Nullable) name
+MPS_CLASS_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3))
+MPS_SWIFT_NAME( convolution3DDataGradient(_:weights:outputShapeTensor:forwardConvolutionDescriptor:name:) );
+
+/*!
+ *  @abstract   Create Convolution 3D gradient op and return the result tensor
+ *  @discussion Computes the gradient of weights input for the forward pass Convolution op with identical parameters.
+ *              See discussion of convolution3DWithSourceTensor for more in depth description of  paramters.
+ *
+ *  @param      incomingGradient                              Incoming gradient tensor
+ *  @param      source                                                    Forward pass source tensor
+ *  @param      outputShape                                         Shape of the forward pass weights tensor
+ *  @param      forwardConvolutionDescriptor   Forward pass op descriptor
+ *  @param      name                                                        The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) convolution3DWeightsGradientWithIncomingGradientTensor:(MPSGraphTensor *) incomingGradient
+                                                              sourceTensor:(MPSGraphTensor *) source
+                                                               outputShape:(MPSShape *) outputShape
+                                              forwardConvolutionDescriptor:(MPSGraphConvolution3DOpDescriptor *) forwardConvolutionDescriptor
+                                                                      name:(NSString * _Nullable) name
+MPS_CLASS_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3))
+MPS_SWIFT_NAME( convolution3DWeightsGradient(_:source:outputShape:forwardConvolutionDescriptor:name:) );
+
+/*!
+ *  @abstract   Create Convolution 3D gradient op and return the result tensor
+ *  @discussion Computes the gradient of weights input for the forward pass Convolution op with identical parameters.
+ *              See discussion of convolution3DWithSourceTensor for more in depth description of  paramters.
+ *
+ *  @param      gradient                                                Incoming gradient tensor
+ *  @param      source                                                    Forward pass source tensor
+ *  @param      outputShapeTensor                           1D int32 or Int64 Tensor. Shape of the forward pass weights tensor
+ *  @param      forwardConvolutionDescriptor   Forward pass op descriptor
+ *  @param      name                                                        The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) convolution3DWeightsGradientWithIncomingGradientTensor:(MPSGraphTensor *) gradient
+                                                              sourceTensor:(MPSGraphTensor *) source
+                                                         outputShapeTensor:(MPSGraphTensor *) outputShapeTensor
+                                              forwardConvolutionDescriptor:(MPSGraphConvolution3DOpDescriptor *) forwardConvolutionDescriptor
+                                                                      name:(NSString * _Nullable) name
+MPS_CLASS_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3))
+MPS_SWIFT_NAME( convolution3DWeightsGradient(_:source:outputShapeTensor:forwardConvolutionDescriptor:name:) );
 
 @end
 
diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphCore.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphCore.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphCore.h	2022-11-10 19:18:36
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphCore.h	2023-02-11 22:22:05
@@ -55,6 +55,10 @@
  *  @constant   MPSGraphTensorNamedDataLayoutCHW             LayoutCHW
  *  @constant   MPSGraphTensorNamedDataLayoutHWC             LayoutHWC
  *  @constant   MPSGraphTensorNamedDataLayoutHW                LayoutHW
+ *  @constant   MPSGraphTensorNamedDataLayoutNCDHW        LayoutNCDHW
+ *  @constant   MPSGraphTensorNamedDataLayoutNDHWC        LayoutNDHWC
+ *  @constant   MPSGraphTensorNamedDataLayoutOIDHW         LayoutOIDHW
+ *  @constant   MPSGraphTensorNamedDataLayoutDHWIO         LayoutDHWIO
  */
 typedef NS_ENUM(NSUInteger, MPSGraphTensorNamedDataLayout)
 {
@@ -65,6 +69,10 @@
     MPSGraphTensorNamedDataLayoutCHW        MPS_ENUM_AVAILABLE_STARTING(macos(11.0), ios(14.0), tvos(14.0))                        =  4L,
     MPSGraphTensorNamedDataLayoutHWC        MPS_ENUM_AVAILABLE_STARTING(macos(11.0), ios(14.0), tvos(14.0))                        =  5L,
     MPSGraphTensorNamedDataLayoutHW         MPS_ENUM_AVAILABLE_STARTING(macos(11.0), ios(14.0), tvos(14.0))                        =  6L,
+    MPSGraphTensorNamedDataLayoutNCDHW      MPS_ENUM_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3))                        =  7L,
+    MPSGraphTensorNamedDataLayoutNDHWC      MPS_ENUM_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3))                        =  8L,
+    MPSGraphTensorNamedDataLayoutOIDHW      MPS_ENUM_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3))                        =  9L,
+    MPSGraphTensorNamedDataLayoutDHWIO      MPS_ENUM_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3))                        =  10L,
 };
 
 /*!
diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphExecutable.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphExecutable.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphExecutable.h	2022-11-12 15:59:14
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphExecutable.h	2023-02-12 14:14:00
@@ -107,6 +107,19 @@
        compilationDescriptor:(MPSGraphCompilationDescriptor * _Nullable) compilationDescriptor;
 
 /*!
+ *  @abstract   Get output shapes for a specialized  MPSGraphExecutable - in case specialization has not been done yet then calling this function will specialize for the given input shapes.
+ *
+ *  @param      device                                    optional MPSGraph device to compile with
+ *  @param      inputTypes                           input types
+ *  @param      compilationDescriptor  compilationDescriptor to be used to specialize, since the executable was created with a compilationDescriptor already this one overrides those settings to the extent it can
+ *
+ */
+-(NSArray<MPSGraphShapedType *> * _Nullable) getOutputTypesWithDevice:(MPSGraphDevice * _Nullable) device
+                                                           inputTypes:(NSArray<MPSGraphType *> *) inputTypes
+                                                compilationDescriptor:(MPSGraphCompilationDescriptor * _Nullable) compilationDescriptor
+MPS_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3));
+
+/*!
  *  @abstract   Runs the graph for given feeds to return targetTensor values, ensuring all target operations also executed.
  *              This call  is synchronous and will return on completion of execution
  *
diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphQuantizationOps.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphQuantizationOps.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphQuantizationOps.h	1969-12-31 19:00:00
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphQuantizationOps.h	2023-02-11 16:43:27
@@ -0,0 +1,159 @@
+//
+//  MPSGraphQuantizationOps.h
+//  MPSGraphQuantizationOps
+//
+//  Created by stevenlariau on 9/30/21.
+//  Copyright © 2021 Apple Inc. All rights reserved.
+//
+
+#ifndef MPSGraphQuantizationOps_h
+#define MPSGraphQuantizationOps_h
+
+#import <MetalPerformanceShadersGraph/MPSGraph.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+#define MPSGRAPH_QUANTIZATION_AVAILABLE
+
+@interface MPSGraph(MPSGraphQuantizationOps)
+
+/*!
+ *  @abstract   Create Quantize op and return the result tensor
+ *  @discussion Convert the float `tensor` to an i8 or u8 tensor by applying a scale + bias transform:
+ *              result = (tensor / scale) + zeroPoint
+ *
+ *  @param      tensor                                  Input tensor to be quantized
+ *  @param      scale                                    Scale scalar parameter
+ *  @param      zeroPoint                           Bias scalar parameter (converted to dataType of resultTensor)
+ *  @param      dataType                             Integer data type of the result tensor
+ *  @param      name                                      The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor array of datatype dataType
+ */
+-(MPSGraphTensor*) quantizeTensor:(MPSGraphTensor*)tensor
+                            scale:(double)scale
+                        zeroPoint:(double)zeroPoint
+                         dataType:(MPSDataType)dataType
+                             name:(NSString * _Nullable) name
+MPS_AVAILABLE_STARTING(macos(13.1), ios(16.2), tvos(16.2))
+MPS_SWIFT_NAME( quantize(_:scale:zeroPoint:dataType:name:) );
+
+/*!
+ *  @abstract   Create Dequantize op and return the result tensor
+ *  @discussion Convert the i8 or u8 `tensor` to a float tensor by applying a scale + bias transform:
+ *              result =  scale * (tensor - zeroPoint)
+ *
+ *  @param      tensor                                  Input tensor to be dequantized
+ *  @param      scale                                    Scale scalar parameter
+ *  @param      zeroPoint                           Bias scalar parameter (converted to dataType of tensor)
+ *  @param      dataType                             Float data type of the result tensor
+ *  @param      name                                      The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor array of datatype dataType
+ */
+-(MPSGraphTensor*) dequantizeTensor:(MPSGraphTensor*)tensor
+                              scale:(double)scale
+                          zeroPoint:(double)zeroPoint
+                           dataType:(MPSDataType)dataType
+                               name:(NSString * _Nullable) name
+MPS_AVAILABLE_STARTING(macos(13.1), ios(16.2), tvos(16.2))
+MPS_SWIFT_NAME( dequantize(_:scale:zeroPoint:dataType:name:) );
+
+/*!
+ *  @abstract   Create Quantize op and return the result tensor
+ *  @discussion Convert the float `tensor` to an i8 or u8 tensor by applying a scale + bias transform:
+ *              result = (tensor / scaleTensor) + zeroPoint
+ *
+ *  @param      tensor                                  Input tensor to be quantized
+ *  @param      scaleTensor                       Scale 1D Tensor parameter with size == tensor.shape[axis]
+ *  @param      zeroPoint                           Bias scalar parameter (converted to dataType of resultTensor)
+ *  @param      dataType                              Integer data type of the result tensor
+ *  @param      axis                                      Axis on which the scale 1D value is being broadcasted
+ *  @param      name                                      The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor array of datatype dataType
+ */
+-(MPSGraphTensor*) quantizeTensor:(MPSGraphTensor*)tensor
+                      scaleTensor:(MPSGraphTensor*)scaleTensor
+                        zeroPoint:(double)zeroPoint
+                         dataType:(MPSDataType)dataType
+                             axis:(NSInteger)axis
+                             name:(NSString * _Nullable) name
+MPS_AVAILABLE_STARTING(macos(13.1), ios(16.2), tvos(16.2))
+MPS_SWIFT_NAME( quantize(_:scaleTensor:zeroPoint:dataType:axis:name:) );
+
+/*!
+ *  @abstract   Create Dequantize op and return the result tensor
+ *  @discussion Convert the i8 or u8 `tensor` to a float tensor by applying a scale + bias transform:
+ *              result =  scaleTensor * (tensor - zeroPoint)
+ *
+ *  @param      tensor                                  Input tensor to be dequantized
+ *  @param      scaleTensor                       Scale scalar or 1D Tensor parameter with size == tensor.shape[axis]
+ *  @param      zeroPoint                           Bias scalar parameter (converted to dataType of tensor)
+ *  @param      dataType                             Float data type of the result tensor
+ *  @param      axis                                      Axis on which the scale 1D value is being broadcasted
+ *  @param      name                                      The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor array of datatype dataType
+ */
+-(MPSGraphTensor*) dequantizeTensor:(MPSGraphTensor*)tensor
+                        scaleTensor:(MPSGraphTensor*)scaleTensor
+                          zeroPoint:(double)zeroPoint
+                           dataType:(MPSDataType)dataType
+                               axis:(NSInteger)axis
+                               name:(NSString * _Nullable) name
+MPS_AVAILABLE_STARTING(macos(13.1), ios(16.2), tvos(16.2))
+MPS_SWIFT_NAME( dequantize(_:scaleTensor:zeroPoint:dataType:axis:name:) );
+
+/*!
+ *  @abstract   Create Quantize op and return the result tensor
+ *  @discussion Convert the float `tensor` to an i8 or u8 tensor by applying a scale + bias transform:
+ *              result = (tensor / scaleTensor) + zeroPointTensor
+ *
+ *  @param      tensor                                  Input tensor to be quantized
+ *  @param      scaleTensor                       Scale scalar or 1D Tensor parameter with size == tensor.shape[axis]
+ *  @param      zeroPointTensor              Bias scalar or 1D Tensor parameter with size == tensor.shape[axis]
+ *  @param      dataType                              Integer data type of the result tensor
+ *  @param      axis                                      Axis on which the scale 1D value is being broadcasted
+ *  @param      name                                      The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor array of datatype dataType
+ */
+-(MPSGraphTensor*) quantizeTensor:(MPSGraphTensor*)tensor
+                      scaleTensor:(MPSGraphTensor*)scaleTensor
+                  zeroPointTensor:(MPSGraphTensor*)zeroPointTensor
+                         dataType:(MPSDataType)dataType
+                             axis:(NSInteger)axis
+                             name:(NSString * _Nullable) name
+MPS_AVAILABLE_STARTING(macos(13.1), ios(16.2), tvos(16.2))
+MPS_SWIFT_NAME( quantize(_:scaleTensor:zeroPointTensor:dataType:axis:name:) );
+
+/*!
+ *  @abstract   Create Dequantize op and return the result tensor
+ *  @discussion Convert the i8 or u8 `tensor` to a float tensor by applying a scale + bias transform:
+ *              result =  scaleTensor * (tensor - zeroPointTensor)
+ *
+ *  @param      tensor                                  Input tensor to be dequantized
+ *  @param      scaleTensor                       Scale scalar or 1D Tensor parameter with size == tensor.shape[axis]
+ *  @param      zeroPointTensor              Bias scalar or 1D Tensor parameter with size == tensor.shape[axis]
+ *  @param      dataType                             Float data type of the result tensor
+ *  @param      axis                                      Axis on which the scale 1D value is being broadcasted
+ *  @param      name                                      The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor array of datatype dataType
+ */
+-(MPSGraphTensor*) dequantizeTensor:(MPSGraphTensor*)tensor
+                        scaleTensor:(MPSGraphTensor*)scaleTensor
+                    zeroPointTensor:(MPSGraphTensor*)zeroPointTensor
+                           dataType:(MPSDataType)dataType
+                               axis:(NSInteger)axis
+                               name:(NSString * _Nullable) name
+MPS_AVAILABLE_STARTING(macos(13.1), ios(16.2), tvos(16.2))
+MPS_SWIFT_NAME( dequantize(_:scaleTensor:zeroPointTensor:dataType:axis:name:) );
+
+@end
+
+
+NS_ASSUME_NONNULL_END
+
+#endif /* MPSGraphQuantizationOps_h */
diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphResizeOps.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphResizeOps.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphResizeOps.h	2022-10-06 13:21:15
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphResizeOps.h	2023-02-11 22:22:05
@@ -23,6 +23,8 @@
     MPSGraphResizeNearestRoundingModeRoundPreferFloor       MPS_ENUM_AVAILABLE_STARTING(macos(13.0), ios(16.0), tvos(16.0))                                    =  1L,
     MPSGraphResizeNearestRoundingModeCeil                   MPS_ENUM_AVAILABLE_STARTING(macos(13.0), ios(16.0), tvos(16.0))                                    =  2L,
     MPSGraphResizeNearestRoundingModeFloor                  MPS_ENUM_AVAILABLE_STARTING(macos(13.0), ios(16.0), tvos(16.0))                                    =  3L,
+    MPSGraphResizeNearestRoundingModeRoundToEven            MPS_ENUM_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3))                                    =  4L,
+    MPSGraphResizeNearestRoundingModeRoundToOdd             MPS_ENUM_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3))                                    =  5L,
 };
 
 MPS_CLASS_AVAILABLE_STARTING(macos(11.0), ios(14.0), tvos(14.0))
diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphSampleGridOps.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphSampleGridOps.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphSampleGridOps.h	1969-12-31 19:00:00
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphSampleGridOps.h	2023-02-11 22:22:05
@@ -0,0 +1,86 @@
+//
+//  MPSGraphSampleGrid.h
+//  MPSGraph
+//
+//  Created on 10/3/22.
+//  Copyright © 2022 Apple Inc. All rights reserved.
+//
+
+#ifndef MPSGraphSampleGrid_h
+#define MPSGraphSampleGrid_h
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface MPSGraph(MPSGraphSampleGrid)
+
+/*!
+ *  @abstract   Samples a tensor using the coordinates provided.
+ *  @discussion Given an input tensor (N, H1, W1, C) or (N, C, H1, W1) and coordinates tensor (N, H2, W2, 2) this operation outputs a tensor of
+ *              size (N, H2, W2, C) or (N, C, H2, W2) by sampling the input tensor at the coordinates provided by the coordinates tensor.
+ *
+ *  @param      source   Tensor containing source data
+ *  @param      coordinates  a tensor (N, Hout, Wout, 2) that contains the coordinates of the samples in the source tensor
+ *              that constitute the output tensor.
+ *  @param      layout Specifies what layout the provided tensor is in. The returned tensor will follow the same layout.
+ *              Valid layouts are NHWC and NCHW.
+ *  @param      normalizeCoordinates If true, coordinates are within [-1, 1] x [-1, 1] otherwise they are in pixels in the input tensor.
+ *  @param      relativeCoordinates If true, coordinates are relative to the postion of the pixel in the output tensor and scaled back to the input tensor size
+ *  @param      alignCorners If true, coordinate extrema are equal to the center of edge pixels, otherwise extrema are equal to outer edge of edge pixels
+ *  @param      paddingMode determines how samples outside the inputTensor are evaluated (only constant, reflect, symmetric and clampToEdge are supported)
+ *  @param      samplingMode Can be either MPSGraphResizeNearest or MPSGraphResizeBilinear. Nearest sampling will use roundPreferCeil.
+ *  @param      constantValue If paddingMode is MPSGraphPaddingModeConstant, then this constant is used for samples outside
+ *              the input tensor.
+ *  @param      name        The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) sampleGridWithSourceTensor:(MPSGraphTensor *) source
+                              coordinateTensor:(MPSGraphTensor *) coordinates
+                                        layout:(MPSGraphTensorNamedDataLayout) layout
+                          normalizeCoordinates:(BOOL) normalizeCoordinates
+                           relativeCoordinates:(BOOL) relativeCoordinates
+                                  alignCorners:(BOOL) alignCorners
+                                   paddingMode:(MPSGraphPaddingMode) paddingMode
+                                  samplingMode:(MPSGraphResizeMode) samplingMode
+                                 constantValue:(double) constantValue
+                                          name:(NSString * _Nullable) name
+MPS_AVAILABLE_STARTING(macos(13.1), ios(16.2), tvos(16.2));
+
+/*!
+ *  @abstract   Samples a tensor using the coordinates provided, using nearest neighbor sampling with specified rounding mode.
+ *  @discussion Given an input tensor (N, H1, W1, C) or (N, C, H1, W1) and coordinates tensor (N, H2, W2, 2) this operation outputs a tensor of
+ *              size (N, H2, W2, C) or (N, C, H2, W2) by sampling the input tensor at the coordinates provided by the coordinates tensor.
+ *
+ *  @param      source   Tensor containing source data
+ *  @param      coordinates  a tensor (N, Hout, Wout, 2) that contains the coordinates of the samples in the source tensor
+ *              that constitute the output tensor.
+ *  @param      layout Specifies what layout the provided tensor is in. The returned tensor will follow the same layout.
+ *              Valid layouts are NHWC and NCHW.
+ *  @param      normalizeCoordinates If true, coordinates are within [-1, 1] x [-1, 1] otherwise they are in pixels in the input tensor.
+ *  @param      relativeCoordinates If true, coordinates are relative to the postion of the pixel in the output tensor and scaled back to the input tensor size
+ *  @param      alignCorners If true, coordinate extrema are equal to the center of edge pixels, otherwise extrema are equal to outer edge of edge pixels
+ *  @param      paddingMode determines how samples outside the inputTensor are evaluated (only constant, reflect, symmetric and clampToEdge are supported)
+ *  @param      nearestRoundingMode The rounding mode to use for determining the nearest neighbor. Valid modes are roundPreferCeil, roundPreferFloor, ceil, and floor.
+ *  @param      constantValue If paddingMode is MPSGraphPaddingModeConstant, then this constant is used for samples outside
+ *              the input tensor.
+ *  @param      name        The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) sampleGridWithSourceTensor:(MPSGraphTensor *) source
+                              coordinateTensor:(MPSGraphTensor *) coordinates
+                                        layout:(MPSGraphTensorNamedDataLayout) layout
+                          normalizeCoordinates:(BOOL) normalizeCoordinates
+                           relativeCoordinates:(BOOL) relativeCoordinates
+                                  alignCorners:(BOOL) alignCorners
+                                   paddingMode:(MPSGraphPaddingMode) paddingMode
+                           nearestRoundingMode:(MPSGraphResizeNearestRoundingMode) nearestRoundingMode
+                                 constantValue:(double) constantValue
+                                          name:(NSString * _Nullable) name
+MPS_AVAILABLE_STARTING(macos(13.1), ios(16.2), tvos(16.2));
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif /* MPSGraphSampleGrid_h */
diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorData.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorData.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorData.h	2022-11-10 19:18:35
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorData.h	2023-02-12 14:10:49
@@ -130,7 +130,7 @@
 
 /*! @abstract   Initialize an MPSGraphTensorData with an MPSImage batch, the dataLayout used will be NHWC,
  *              call a transpose or permute to change to a layout of your choice.
- *  @param      imageBatch  The device on which the kernel will run
+ *  @param      imageBatch  The device on which the kernel will run, unorm8 and unorm16 images will create a float32 tensorData
  *  @return     A valid MPSGraphTensorData, or nil if allocation failure.
  */
 -(instancetype) initWithMPSImageBatch:(MPSImageBatch *) imageBatch
diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorShapeOps.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorShapeOps.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorShapeOps.h	2022-11-10 19:18:36
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorShapeOps.h	2023-02-11 16:43:29
@@ -560,6 +560,24 @@
 MPS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0));
 
 /*!
+ *  @abstract   Create reinterpret cast op and return the result tensor
+ *  @discussion Returns input tensor (with element type `tensor_type`)  reinterpreted to element type `type`
+ *              passed in with the last dimension scaled by `sizeof(tensor_type) / sizeof(type)`.
+ *              This operation is endianness agnostic and data will be reinterpreted with the endianness of the
+ *              system.
+ *
+ *  @param      tensor        Input tensor
+ *  @param      type        The element type of the returned tensor.
+ *  @param      name            The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+- (MPSGraphTensor *)reinterpretCastTensor:(MPSGraphTensor *)tensor
+                                   toType:(MPSDataType)type
+                                     name:(NSString *_Nullable)name
+MPS_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3));
+
+/*!
  *  @abstract   Create stack op and return the result
  *  @discussion Stacks all input tensors along `axis` into a result tensor of rank + 1. Tensors must be broadcast
  *              compatible along all dimensions, and have the same type.
diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MetalPerformanceShadersGraph.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MetalPerformanceShadersGraph.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MetalPerformanceShadersGraph.h	2022-09-30 04:02:54
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MetalPerformanceShadersGraph.h	2023-02-10 09:57:33
@@ -27,10 +27,12 @@
 #import <MetalPerformanceShadersGraph/MPSGraphOneHotOps.h>
 #import <MetalPerformanceShadersGraph/MPSGraphOptimizerOps.h>
 #import <MetalPerformanceShadersGraph/MPSGraphPoolingOps.h>
+#import <MetalPerformanceShadersGraph/MPSGraphQuantizationOps.h>
 #import <MetalPerformanceShadersGraph/MPSGraphRandomOps.h>
 #import <MetalPerformanceShadersGraph/MPSGraphReductionOps.h>
 #import <MetalPerformanceShadersGraph/MPSGraphResizeOps.h>
 #import <MetalPerformanceShadersGraph/MPSGraphRNNOps.h>
+#import <MetalPerformanceShadersGraph/MPSGraphSampleGridOps.h>
 #import <MetalPerformanceShadersGraph/MPSGraphScatterNDOps.h>
 #import <MetalPerformanceShadersGraph/MPSGraphSortOps.h>
 #import <MetalPerformanceShadersGraph/MPSGraphSparseOps.h>
Clone this wiki locally