Skip to content

MetalPerformanceShadersGraph iOS xcode14.2 rc

Alex Soto edited this page Dec 7, 2022 · 1 revision

#MetalPerformanceShadersGraph.framework

diff -ruN /Applications/Xcode_14.1.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphQuantizationOps.h /Applications/Xcode_14.2.0-rc.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphQuantizationOps.h
--- /Applications/Xcode_14.1.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphQuantizationOps.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_14.2.0-rc.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphQuantizationOps.h	2022-11-10 19:16:14.000000000 -0500
@@ -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.1.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphSampleGridOps.h /Applications/Xcode_14.2.0-rc.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphSampleGridOps.h
--- /Applications/Xcode_14.1.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphSampleGridOps.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_14.2.0-rc.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphSampleGridOps.h	2022-11-10 19:18:36.000000000 -0500
@@ -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.1.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MetalPerformanceShadersGraph.h /Applications/Xcode_14.2.0-rc.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MetalPerformanceShadersGraph.h
--- /Applications/Xcode_14.1.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MetalPerformanceShadersGraph.h	2022-09-30 06:41:44.000000000 -0400
+++ /Applications/Xcode_14.2.0-rc.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MetalPerformanceShadersGraph.h	2022-11-06 15:49:23.000000000 -0500
@@ -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