Skip to content

MetalPerformanceShadersGraph tvOS xcode13.0 beta5

Manuel de la Pena edited this page Aug 10, 2021 · 1 revision

#MetalPerformanceShadersGraph.framework

diff -ruN /Applications/Xcode_13.0.0-beta4.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraph.h /Applications/Xcode_13.0.0-beta5.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraph.h
--- /Applications/Xcode_13.0.0-beta4.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraph.h	2021-07-22 04:36:07.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta5.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraph.h	2021-08-09 03:25:27.000000000 -0400
@@ -253,7 +253,7 @@
  *  @abstract   Encodes graph for given feeds to return targetTensor values, ensuring all target operations also executed.
  *              This call  is asynchronous and will return immediately if a completionHandler is set.
  *
- *  @param      commandBuffer                                      commandBuffer passed to exectute the graph on
+ *  @param      commandBuffer                                      commandBuffer passed to exectute the graph on, it is an MPSCommandBuffer, commitAndContinue might be called, please don't rely on underlying MTLCommandBuffer to remain uncommitted
  *  @param      feeds                                                       Feeds dictionary for the placeholder tensors
  *  @param      targetTensors                                     Tensors for which the caller wishes MPSGraphTensorData to be returned
  *  @param      targetOperations                              Operations to be completed at the end of the run
@@ -272,7 +272,7 @@
  *  @abstract   Encodes the graph for given feeds to return targetTensor values in the resultsDictionary provided by the user,
  *              ensuring all target operations also executed. This call  is asynchronous and will return immediately if a completionHandler is set.
  *
- *  @param      commandBuffer                                      commandBuffer passed to exectute the graph on
+ *  @param      commandBuffer                                      commandBuffer passed to exectute the graph on, commitAndContinue might be called, please don't rely on underlying MTLCommandBuffer to remain uncommitted
  *  @param      feeds                                                       Feeds dictionary for the placeholder tensors
  *  @param      targetOperations                              Operations to be completed at the end of the run
  *  @param      resultsDictionary                            MPSGraphTensors dictionary passed by user, these will be filled with graph output data
diff -ruN /Applications/Xcode_13.0.0-beta4.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphActivationOps.h /Applications/Xcode_13.0.0-beta5.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphActivationOps.h
--- /Applications/Xcode_13.0.0-beta4.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphActivationOps.h	2021-07-22 04:36:06.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta5.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphActivationOps.h	2021-08-07 08:51:27.000000000 -0400
@@ -44,6 +44,28 @@
                                                    axis:(NSInteger) axis
                                                    name:(NSString * _Nullable) name;
 
+
+/*!
+ * @brief Leaky ReLU activation tensor
+ * @discussion Specifies the leaky ReLU activation tensor.
+ *             For each pixel, applies the following function: f(x) = max(x, alpha * x)
+ */
+-(MPSGraphTensor*)leakyReLUWithTensor:(MPSGraphTensor* _Nonnull)tensor
+                                alpha:(double) alpha
+                                 name:(NSString* _Nullable) name
+MPS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0));
+
+-(MPSGraphTensor*)leakyReLUWithTensor:(MPSGraphTensor* _Nonnull) tensor
+                          alphaTensor:(MPSGraphTensor* _Nonnull) alphaTensor
+                                 name:(NSString* _Nullable) name
+MPS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0));
+
+-(MPSGraphTensor*)leakyReLUGradientWithIncomingGradient:(MPSGraphTensor *) gradient
+                                           sourceTensor:(MPSGraphTensor* _Nonnull) source
+                                            alphaTensor:(MPSGraphTensor* _Nonnull) alphaTensor
+                                                   name:(NSString* _Nullable) name
+MPS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0));
+
 @end
 
 NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_13.0.0-beta4.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphConvolutionOps.h /Applications/Xcode_13.0.0-beta5.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphConvolutionOps.h
--- /Applications/Xcode_13.0.0-beta4.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphConvolutionOps.h	2021-07-22 14:19:18.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta5.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphConvolutionOps.h	2021-08-07 05:21:46.000000000 -0400
@@ -79,6 +79,19 @@
                                              name:(NSString * _Nullable) name
 MPS_SWIFT_NAME( convolution2D(_:weights:descriptor:name:) );
 
+/*!
+ *  @abstract   Create Convolution 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 convolution2DWithSourceTensor 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 *) convolution2DDataGradientWithIncomingGradientTensor:(MPSGraphTensor *) incomingGradient
                                                           weightsTensor:(MPSGraphTensor *) weights
                                                             outputShape:(MPSShape *) outputShape
@@ -86,6 +99,40 @@
                                                                    name:(NSString * _Nullable) name
 MPS_SWIFT_NAME( convolution2DDataGradient(_:weights:outputShape:forwardConvolutionDescriptor:name:) );
 
+/*!
+ *  @abstract   Create Convolution 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 convolution2DWithSourceTensor 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 *) convolution2DDataGradientWithIncomingGradientTensor:(MPSGraphTensor *) gradient
+                                                          weightsTensor:(MPSGraphTensor *) weights
+                                                      outputShapeTensor:(MPSGraphTensor *) outputShapeTensor
+                                           forwardConvolutionDescriptor:(MPSGraphConvolution2DOpDescriptor *) forwardConvolutionDescriptor
+                                                                   name:(NSString * _Nullable) name
+MPS_CLASS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0))
+MPS_SWIFT_NAME( convolution2DDataGradient(_:weights:outputShapeTensor:forwardConvolutionDescriptor:name:) );
+
+/*!
+ *  @abstract   Create Convolution 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 convolution2DWithSourceTensor 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 *) convolution2DWeightsGradientWithIncomingGradientTensor:(MPSGraphTensor *) incomingGradient
                                                               sourceTensor:(MPSGraphTensor *) source
                                                                outputShape:(MPSShape *) outputShape
@@ -93,6 +140,27 @@
                                                                       name:(NSString * _Nullable) name
 MPS_SWIFT_NAME( convolution2DWeightsGradient(_:source:outputShape:forwardConvolutionDescriptor:name:) );
 
+/*!
+ *  @abstract   Create Convolution 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 convolution2DWithSourceTensor 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 *) convolution2DWeightsGradientWithIncomingGradientTensor:(MPSGraphTensor *) gradient
+                                                              sourceTensor:(MPSGraphTensor *) source
+                                                         outputShapeTensor:(MPSGraphTensor *) outputShapeTensor
+                                              forwardConvolutionDescriptor:(MPSGraphConvolution2DOpDescriptor *) forwardConvolutionDescriptor
+                                                                      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:) );
+
 @end
 
 NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_13.0.0-beta4.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphConvolutionTransposeOps.h /Applications/Xcode_13.0.0-beta5.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphConvolutionTransposeOps.h
--- /Applications/Xcode_13.0.0-beta4.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphConvolutionTransposeOps.h	2021-07-22 04:36:06.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta5.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphConvolutionTransposeOps.h	2021-08-09 03:25:26.000000000 -0400
@@ -16,18 +16,30 @@
 MPS_CLASS_AVAILABLE_STARTING(macos(11.0), ios(14.0), tvos(14.0))
 @interface MPSGraph(MPSGraphConvolutionTransposeOps)
 
-/*! Convolution Tranpose op is exactly the same as convolution gradint with respect to input image (convolution2DDataGradient)
- *  Weights tensor and source tensors are interpreted as they are in convolution2DDataGradientWithIncomingGradient. For example
- *  if weightsTensor layout is HWIO, inner most (fastest moving) dimension, denoted by O here should be equal to inputFeatureChannels i.e. number of channels in source tensor
- *  and next fasted moving dimension denoated by I is equal to number of channels in returns (destination) tensor outputFeatureChannels.
- *  TensorFlow interprets the weights tensor same way excpet that it states weights are in HWOI format. We dont define another weights format enum
- *  rather we reinterpret HWIO just like TensorFlow does for gradient with data. 
- *  Normally in auto encoder, convoluton transpose
- *  is associated with regular convolution i.e. convolution downsamples by stride s and convolution tranpose upsamples by factor s. In that case, convolution
- *  transpose can map same source size to multiple destination sizes. The relationship between sourceWidth and destinationWidth is
- *                     (sourceWidth - 1) * stride + 1 + (kernelWidth - 1) * dilationRate <= destinationWidth + paddingLeft + paddingRight
- *  so there are stride -1 destinationWidth that give same sourceWidth. In order to disambiguate, outputShape parameter is used. This is what TensorFlow does.
- *  PyTourch takes additional outputPadding that is applied to destination size.
+/*!
+ *  @abstract   Create ConvolutionTranspose op and return the result tensor
+ *  @discussion Convolution Tranpose op is exactly the same as convolution gradint with respect to input image (convolution2DDataGradient)
+ *              Weights tensor and source tensors are interpreted as they are in convolution2DDataGradientWithIncomingGradient. For example
+ *              if weightsTensor layout is HWIO, inner most (fastest moving) dimension, denoted by O here should be equal to inputFeatureChannels
+ *              i.e. number of channels in source tensor
+ *              and next fasted moving dimension denoated by I is equal to number of channels in returns (destination) tensor outputFeatureChannels.
+ *              TensorFlow interprets the weights tensor same way excpet that it states weights are in HWOI format. We dont define another weights format enum
+ *              rather we reinterpret HWIO just like TensorFlow does for gradient with data.
+ *              Normally in auto encoder, convoluton transpose is associated with regular convolution i.e. convolution downsamples by stride s
+ *              and convolution tranpose upsamples by factor s.
+ *              In that case, convolution transpose can map same source size to multiple destination sizes. The relationship between sourceWidth and destinationWidth is
+ *              (sourceWidth - 1) * stride + 1 + (kernelWidth - 1) * dilationRate <= destinationWidth + paddingLeft + paddingRight
+ *              so there are stride -1 destinationWidth that give same sourceWidth. In order to disambiguate, outputShape parameter is used.
+ *              This is what TensorFlow does.
+ *              PyTourch takes additional outputPadding that is applied to destination size.
+ *
+ * @param       source             input tensor
+ * @param       weights           weights tensor
+ * @param       outputShape  shape of the result tensor
+ * @param       descriptor    descriptor for the corresponding forward Conv2d operation
+ * @param       name                 name for the operation
+ *
+ * @return      A valid MPSGraphTensor object.
  */
 -(MPSGraphTensor *) convolutionTranspose2DWithSourceTensor:(MPSGraphTensor *) source
                                              weightsTensor:(MPSGraphTensor *) weights
@@ -36,6 +48,52 @@
                                                       name:(NSString * _Nullable) name
 MPS_SWIFT_NAME( convolutionTranspose2D(_:weights:outputShape:descriptor:name:) );
 
+/*!
+ *  @abstract   Create ConvolutionTranspose op and return the result tensor
+ *  @discussion Convolution Tranpose op is exactly the same as convolution gradint with respect to input image (convolution2DDataGradient)
+ *              Weights tensor and source tensors are interpreted as they are in convolution2DDataGradientWithIncomingGradient. For example
+ *              if weightsTensor layout is HWIO, inner most (fastest moving) dimension, denoted by O here should be equal to inputFeatureChannels
+ *              i.e. number of channels in source tensor
+ *              and next fasted moving dimension denoated by I is equal to number of channels in returns (destination) tensor outputFeatureChannels.
+ *              TensorFlow interprets the weights tensor same way excpet that it states weights are in HWOI format. We dont define another weights format enum
+ *              rather we reinterpret HWIO just like TensorFlow does for gradient with data.
+ *              Normally in auto encoder, convoluton transpose is associated with regular convolution i.e. convolution downsamples by stride s
+ *              and convolution tranpose upsamples by factor s.
+ *              In that case, convolution transpose can map same source size to multiple destination sizes. The relationship between sourceWidth and destinationWidth is
+ *              (sourceWidth - 1) * stride + 1 + (kernelWidth - 1) * dilationRate <= destinationWidth + paddingLeft + paddingRight
+ *              so there are stride -1 destinationWidth that give same sourceWidth. In order to disambiguate, outputShape parameter is used.
+ *              This is what TensorFlow does.
+ *              PyTourch takes additional outputPadding that is applied to destination size.
+ *
+ * @param       source             input tensor
+ * @param       weights           weights tensor
+ * @param       outputShape  1D Int32 or Int64 tensor. shape of the result tensor
+ * @param       descriptor    descriptor for the corresponding forward Conv2d operation
+ * @param       name                 name for the operation
+ *
+ * @return      A valid MPSGraphTensor object.
+ */
+-(MPSGraphTensor *) convolutionTranspose2DWithSourceTensor:(MPSGraphTensor *) source
+                                             weightsTensor:(MPSGraphTensor *) weights
+                                         outputShapeTensor:(MPSGraphTensor*) outputShape
+                                                descriptor:(MPSGraphConvolution2DOpDescriptor *) descriptor
+                                                      name:(NSString * _Nullable) name
+MPS_CLASS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0))
+MPS_SWIFT_NAME( convolutionTranspose2D(_:weights:outputShapeTensor:descriptor:name:) );
+
+/*!
+ *  @abstract   Create ConvolutionTranspose gradient op and return the result tensor
+ *  @discussion Computes the gradient of source input for the forward pass ConvolutionTranspose op with identical parameters.
+ *              See discussion of convolutionTranspose2DWithSourceTensor 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 *) convolutionTranspose2DDataGradientWithIncomingGradientTensor:(MPSGraphTensor *) incomingGradient
                                                                    weightsTensor:(MPSGraphTensor *) weights
                                                                      outputShape:(MPSShape *) outputShape
@@ -43,6 +101,40 @@
                                                                             name:(NSString * _Nullable) name
 MPS_SWIFT_NAME( convolutionTranspose2DDataGradient(_:weights:outputShape:forwardConvolutionDescriptor:name:) );
 
+/*!
+ *  @abstract   Create ConvolutionTranspose gradient op and return the result tensor
+ *  @discussion Computes the gradient of source input for the forward pass ConvolutionTranspose op with identical parameters.
+ *              See discussion of convolutionTranspose2DWithSourceTensor for more in depth description of  paramters.
+ *
+ *  @param      incomingGradient                              Incoming gradient tensor
+ *  @param      weights                                                  Forward pass weights tensor
+ *  @param      outputShape                                         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 *) convolutionTranspose2DDataGradientWithIncomingGradientTensor:(MPSGraphTensor *) incomingGradient
+                                                                   weightsTensor:(MPSGraphTensor *) weights
+                                                               outputShapeTensor:(MPSGraphTensor *) outputShape
+                                                    forwardConvolutionDescriptor:(MPSGraphConvolution2DOpDescriptor *) forwardConvolutionDescriptor
+                                                                            name:(NSString * _Nullable) name
+MPS_CLASS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0))
+MPS_SWIFT_NAME( convolutionTranspose2DDataGradient(_:weights:outputShapeTensor:forwardConvolutionDescriptor:name:) );
+
+/*!
+ *  @abstract   Create ConvolutionTranspose gradient op and return the result tensor
+ *  @discussion Computes the gradient of weights input for the forward pass ConvolutionTranspose op with identical parameters.
+ *              See discussion of convolutionTranspose2DWithSourceTensor for more in depth description of  paramters.
+ *
+ *  @param      incomingGradientTensor                 Incoming gradient tensor
+ *  @param      source                                                    Forward pass source tensor
+ *  @param      outputShape                                         Shape of the forward pass source weights tensor
+ *  @param      forwardConvolutionDescriptor   Forward pass op descriptor
+ *  @param      name                                                        The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
 -(MPSGraphTensor *) convolutionTranspose2DWeightsGradientWithIncomingGradientTensor:(MPSGraphTensor *) incomingGradientTensor
                                                                        sourceTensor:(MPSGraphTensor *) source
                                                                         outputShape:(MPSShape *) outputShape
@@ -50,6 +142,27 @@
                                                                                name:(NSString * _Nullable) name
 MPS_SWIFT_NAME( convolutionTranspose2DWeightsGradient(_:weights:outputShape:forwardConvolutionDescriptor:name:) );
 
+/*!
+ *  @abstract   Create ConvolutionTranspose gradient op and return the result tensor
+ *  @discussion Computes the gradient of weights input for the forward pass ConvolutionTranspose op with identical parameters.
+ *              See discussion of convolutionTranspose2DWithSourceTensor for more in depth description of  paramters.
+ *
+ *  @param      incomingGradientTensor                 Incoming gradient tensor
+ *  @param      source                                                    Forward pass source tensor
+ *  @param      outputShape                                         1D Int32 or Int64 Tensor. Shape of the forward pass source weights tensor
+ *  @param      forwardConvolutionDescriptor   Forward pass op descriptor
+ *  @param      name                                                        The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) convolutionTranspose2DWeightsGradientWithIncomingGradientTensor:(MPSGraphTensor *) incomingGradientTensor
+                                                                       sourceTensor:(MPSGraphTensor *) source
+                                                                  outputShapeTensor:(MPSGraphTensor *) outputShape
+                                                       forwardConvolutionDescriptor:(MPSGraphConvolution2DOpDescriptor *) forwardConvolutionDescriptor
+                                                                               name:(NSString * _Nullable) name
+MPS_CLASS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0))
+MPS_SWIFT_NAME( convolutionTranspose2DWeightsGradient(_:weights:outputShapeTensor:forwardConvolutionDescriptor:name:) );
+
 @end
 
 NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_13.0.0-beta4.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphResizeOps.h /Applications/Xcode_13.0.0-beta5.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphResizeOps.h
--- /Applications/Xcode_13.0.0-beta4.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphResizeOps.h	2021-07-22 04:36:06.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta5.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphResizeOps.h	2021-08-07 05:21:47.000000000 -0400
@@ -62,7 +62,54 @@
                     centerResult:(BOOL) centerResult
                     alignCorners:(BOOL) alignCorners
                           layout:(MPSGraphTensorNamedDataLayout) layout
-                            name:(NSString * _Nullable) name;
+                            name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( resize(_:size:mode:centerResult:alignCorners:layout:name:) );
+
+/*!
+ *  @abstract   Create Resize op and return the result tensor
+ *  @discussion Resamples input images to given size. Result images will be distorted if size is of different aspect ratio.
+ *              Resize supports the following modes:
+ *                  Nearest Neighnor - values are interpolated using the closest neighbor pixel
+ *                  Bilinear - values are computed using bilinear interpolation of 4 neighboring pixels
+ *
+ *              Destination indices are computed using direct index scaling by default, with no offset added.
+ *              If the centerResult parameter is true, the destination indices will be scaled and shifted to be centered
+ *              on the input image.
+ *              If the alignCorners parameter is true, the corners of the result images will match the input images.
+ *              Scaling will be modified to a factor of (size - 1) / (inputSize - 1). When alignCorners is true, the
+ *              centerResult parameter does nothing.
+ *
+ *              In order to achieve the same behavior as OpenCV's resize and TensorFlowV2's resize,
+ *              @code
+ *                  centerResult = YES;
+ *                  alginCorners = NO;
+ *              @endcode
+ *
+ *              To achieve the same behavior as TensorFlowV1 resize
+ *              @code
+ *                  centerResult = NO;
+ *              @endcode
+ *
+ *  @param      imagesTensor    Tensor containing input images.
+ *  @param      size                      1D Int32 or Int64 tensor. A 2-element shape as [newHeight, newWidth]
+ *  @param      mode                      The resampling mode to use.
+ *  @param      centerResult    Controls if the result image is centered on the input image. When NO, the result will have the top left corner aligned
+ *  @param      alignCorners    When YES, the result image will have the same value as the input image in the corners
+ *  @param      layout                  Specifies what layout the provided tensor is in. The returned tensor will follow the same layout.
+ *                            Valid layouts are NHWC, NCHW, HWC, CHW, and HW.
+ *  @param      name                      The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) resizeTensor:(MPSGraphTensor *) imagesTensor
+                      sizeTensor:(MPSGraphTensor *) size
+                            mode:(MPSGraphResizeMode) mode
+                    centerResult:(BOOL) centerResult
+                    alignCorners:(BOOL) alignCorners
+                          layout:(MPSGraphTensorNamedDataLayout) layout
+                            name:(NSString * _Nullable) name
+MPS_CLASS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0))
+MPS_SWIFT_NAME( resize(_:sizeTensor:mode:centerResult:alignCorners:layout:name:) );
 
 
 /*!
diff -ruN /Applications/Xcode_13.0.0-beta4.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphScatterNDOps.h /Applications/Xcode_13.0.0-beta5.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphScatterNDOps.h
--- /Applications/Xcode_13.0.0-beta4.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphScatterNDOps.h	2021-07-22 14:32:56.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta5.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphScatterNDOps.h	2021-08-09 03:22:24.000000000 -0400
@@ -34,6 +34,8 @@
     MPSGraphScatterModeSet     MPS_ENUM_AVAILABLE_STARTING(macos(11.0), ios(14.0), tvos(14.0))                     =  6L,
 };
 
+#pragma mark ScatterND
+
 MPS_CLASS_AVAILABLE_STARTING(macos(11.0), ios(14.0), tvos(14.0))
 @interface MPSGraph(ScatterNDOps)
 
@@ -109,6 +111,126 @@
                                batchDimensions:(NSUInteger) batchDimensions
                                           name:(NSString * _Nullable) name;
 
+/*!
+ *  @abstract   Create ScatterND op and return the result tensor
+ *  @discussion Scatters the slices in updatesTensor to the result tensor along the indices in indicesTensor, on top of dataTensor.
+ *              The scatter is defined as
+ *              @code
+ *              B = batchDims
+ *              U = updates.rank - B
+ *              P = res.rank - B
+ *              Q = inds.rank - B
+ *              K = inds.shape[-1]
+ *              index_slice = indices[i_{b0},...,i_{bB},i_{0},..,i_{Q-1}]
+ *              res[...] = data[...]
+ *              res[i_{b0},...,i_{bB},index_slice[0],...,index_slice[K-1]] += updates[i_{b0},...,i_{bB},i_{0},...,i_{Q-1}] // Note += is used but this depends on mode
+ *              @endcode
+ *              Collsions will be updated according to mode, and slices not set by indices are set to 0. The tensors have the following shape requirements
+ *              @code
+ *              K <= P
+ *              U = (P-K) + Q-1
+ *              data.shape = res.shape
+ *              indices.shape[0:Q-1] = updates.shape[0:Q-1]
+ *              updates.shape[Q:U] = res.shape[K:P]
+ *              @endcode
+ *
+ *  @param      dataTensor      Tensor containing inital values of same shape as result tensor
+ *  @param      updatesTensor   Tensor containing slices to be inserted into the result tensor
+ *  @param      indicesTensor   Tensor containg the result indices to insert slices at
+ *  @param      batchDimensions The number of batch dimensions
+ *  @param      mode            The type of update to use on the destination
+ *  @param      name            The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) scatterNDWithDataTensor:(MPSGraphTensor *) dataTensor
+                              updatesTensor:(MPSGraphTensor *) updatesTensor
+                              indicesTensor:(MPSGraphTensor *) indicesTensor
+                            batchDimensions:(NSUInteger) batchDimensions
+                                       mode:(MPSGraphScatterMode) mode
+                                       name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( scatterNDWithData(_:updates:indices:batchDimensions:mode:name:) )
+MPS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0));
+
+@end
+
+#pragma mark Scatter
+
+@interface MPSGraph(MPSGraphScatterOps)
+
+/*!
+ *  @abstract   Create Scatter op and return the result tensor
+ *  @discussion Scatters the slices in updatesTensor to the result tensor along the indices in indicesTensor.
+ *              The scatter is defined as
+ *              @code
+ *              U = updates.rank
+ *              P = res.rank
+ *              res[i_{0},...,i_{axis-1},indices[i_{axis}],i_{axis+1},...,i_{U-1}] = updates[i_{0},...,i_{axis-1},i_{axis},i_{axis+1},...,i_{U-1}]
+ *              @endcode
+ *              Collsions will be updated according to mode. The tensors have the following shape requirements
+ *              @code
+ *              U = P
+ *              indices.rank = 1
+ *              updates.shape[0:axis-1] = res.shape[0:axis-1]
+ *              updates.shape[axis]     = indices.shape[0]
+ *              updates.shape[axis+1:U] = res.shape[0:P]
+ *              @endcode
+ *
+ *  @param      updatesTensor     Tensor containing values to be inserted into the result tensor
+ *  @param      indicesTensor     Tensor containg the result indices to insert values at
+ *  @param      shape             The shape of the result tensor
+ *  @param      axis              The axis of the result tensor to scatter values along
+ *  @param      mode              The type of update to use on the destination
+ *  @param      name              The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) scatterWithUpdatesTensor:(MPSGraphTensor *) updatesTensor
+                               indicesTensor:(MPSGraphTensor *) indicesTensor
+                                       shape:(MPSShape *) shape
+                                        axis:(NSInteger) axis
+                                        mode:(MPSGraphScatterMode) mode
+                                        name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( scatter(_:indices:shape:axis:mode:name:) )
+MPS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0));
+
+/*!
+ *  @abstract   Create Scatter op and return the result tensor
+ *  @discussion Scatters the slices in updatesTensor to the result tensor along the indices in indicesTensor, on top of dataTensor.
+ *              The scatter is defined as
+ *              @code
+ *              U = updates.rank
+ *              P = res.rank
+ *              res[...] = data[...]
+ *              res[i_{0},...,i_{axis-1},indices[i_{axis}],i_{axis+1},...,i_{U-1}] += updates[i_{0},...,i_{axis-1},i_{axis},i_{axis+1},...,i_{U-1}] // Note += is used but this depends on mode
+ *              @endcode
+ *              Collsions will be updated according to mode. The tensors have the following shape requirements
+ *              @code
+ *              U = P
+ *              indices.rank = 1
+ *              data.shape = res.shape
+ *              updates.shape[0:axis-1] = res.shape[0:axis-1]
+ *              updates.shape[axis]     = indices.shape[0]
+ *              updates.shape[axis+1:U] = res.shape[0:P]
+ *              @endcode
+ *
+ *  @param      dataTensor        Tensor containing inital values of same shape as result tensor
+ *  @param      updatesTensor     Tensor containing values to be inserted into the result tensor
+ *  @param      indicesTensor     Tensor containg the result indices to insert values at
+ *  @param      axis              The axis of the result tensor to scatter values along
+ *  @param      mode              The type of update to use on the destination
+ *  @param      name              The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) scatterWithDataTensor:(MPSGraphTensor *) dataTensor
+                            updatesTensor:(MPSGraphTensor *) updatesTensor
+                            indicesTensor:(MPSGraphTensor *) indicesTensor
+                                     axis:(NSInteger) axis
+                                     mode:(MPSGraphScatterMode) mode
+                                     name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( scatterWithData(_:updates:indices:axis:mode:name:) )
+MPS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0));
 @end
 
 NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_13.0.0-beta4.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphSparseOps.h /Applications/Xcode_13.0.0-beta5.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphSparseOps.h
--- /Applications/Xcode_13.0.0-beta4.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphSparseOps.h	2021-07-22 14:19:18.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta5.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphSparseOps.h	2021-08-07 08:51:27.000000000 -0400
@@ -27,7 +27,7 @@
     MPSGraphSparseStorageCSR MPS_ENUM_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0)) = 2L,
 };
 
-MPS_ENUM_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0))
+MPS_CLASS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0))
 @interface MPSGraphCreateSparseOpDescriptor : NSObject <NSCopying>
 
 @property(readwrite, nonatomic) MPSGraphSparseStorageType sparseStorageType;
@@ -39,7 +39,6 @@
 
 @end
 
-MPS_ENUM_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0))
 @interface MPSGraph (MPSGraphSparseOps)
 
 /*!
@@ -64,6 +63,7 @@
                                    shape:(MPSShape *)shape
                                 dataType:(MPSDataType)dataType
                                     name:(NSString *_Nullable)name
+    MPS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0))
     MPS_SWIFT_NAME(sparseTensor(sparseTensorWithType:tensors:shape:dataType:name:));
 
 /*!
@@ -86,6 +86,7 @@
                                        tensors:(NSArray<MPSGraphTensor *> *)inputTensorArray
                                          shape:(MPSShape *)shape
                                           name:(NSString *_Nullable)name
+    MPS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0))
     MPS_SWIFT_NAME(sparseTensor(sparseTensorWithDescriptor:tensors:shape:name:));
 
 @end
diff -ruN /Applications/Xcode_13.0.0-beta4.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorShapeOps.h /Applications/Xcode_13.0.0-beta5.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorShapeOps.h
--- /Applications/Xcode_13.0.0-beta4.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorShapeOps.h	2021-07-22 14:32:57.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta5.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorShapeOps.h	2021-08-09 03:22:24.000000000 -0400
@@ -17,11 +17,41 @@
 MPS_CLASS_AVAILABLE_STARTING(macos(11.0), ios(14.0), tvos(14.0))
 @interface MPSGraph(MPSGraphTensorShapeOps)
 
+/*!
+ *  @abstract   Create Reshape op and return the result tensor
+ *  @discussion Reshape the input tensor to the target shape
+ *              The shape must be compatible with the input tensor shape
+ *              shape is allowed to contain dynamic dimensions (-1) when the result type can be inferred unambiguously
+ *
+ *  @param      tensor                  Tensor to be reshaped.
+ *  @param      shape                    The result tensor shape
+ *  @param      name                      The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
 -(MPSGraphTensor *) reshapeTensor:(MPSGraphTensor *) tensor
                         withShape:(MPSShape *) shape
                              name:(NSString * _Nullable) name
 MPS_SWIFT_NAME( reshape(_:shape:name:) );
 
+/*!
+ *  @abstract   Create Reshape op and return the result tensor
+ *  @discussion Reshape the input tensor to the target shapeTensor
+ *              The shape must be compatible with the input tensor shape
+ *              shapeTensor is allowed to contain dynamic dimensions (-1) when the result type can be inferred unambiguously
+ *
+ *  @param      tensor                  Tensor to be reshaped.
+ *  @param      shapeTensor       1D Int32 or Int64 tensor. The result tensor shape
+ *  @param      name                      The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) reshapeTensor:(MPSGraphTensor *) tensor
+                  withShapeTensor:(MPSGraphTensor *) shapeTensor
+                             name:(NSString * _Nullable) name
+MPS_CLASS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0))
+MPS_SWIFT_NAME( reshape(_:shapeTensor:name:) );
+
 -(MPSGraphTensor *) transposeTensor:(MPSGraphTensor *) tensor
                           dimension:(NSUInteger) dimensionIndex
                       withDimension:(NSUInteger) dimensionIndex2
@@ -331,6 +361,71 @@
 MPS_SWIFT_NAME( flatten2D(_:axisTensor:name:) )
 MPS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0));
 
+/*!
+ *  @abstract   Create broadcast op and return the result tensor
+ *  @discussion Broadcast values inside the tensor, starting from the trailing dimensions, to give it the correct shape.
+ *              This is equivalent to the broadcasting for arithmetic operations when operands have different shapes.
+ *
+ *  @param      tensor        Tensor to be broadcasted
+ *  @param      shape          Shape of the result tensor
+ *  @param      name            The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+
+-(MPSGraphTensor *) broadcastTensor:(MPSGraphTensor *) tensor
+                            toShape:(MPSShape *) shape
+                               name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( broadcast(_:shape:name:) )
+MPS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0));
+
+/*!
+ *  @abstract   Create broadcast op and return the result tensor
+ *  @discussion Broadcast values inside the tensor, starting from the trailing dimensions, to give it the correct shape.
+ *              This is equivalent to the broadcasting for arithmetic operations when operands have different shapes.
+ *
+ *  @param      tensor                Tensor to be broadcasted
+ *  @param      shapeTensor     1D Int32 or Int64 tensor. Shape of the result tensor
+ *  @param      name                     The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+
+-(MPSGraphTensor *) broadcastTensor:(MPSGraphTensor *) tensor
+                      toShapeTensor:(MPSGraphTensor *) shapeTensor
+                               name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( broadcast(_:shapeTensor:name:) )
+MPS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0));
+
+/*!
+ *  @abstract   Create shapeof op and return the result tensor
+ *  @discussion Returns a 1D Int32 tensor with value the static shape of the input tensor
+ *
+ *  @param      tensor        Input tensor
+ *  @param      name            The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+
+-(MPSGraphTensor *) shapeOfTensor:(MPSGraphTensor *) tensor
+                             name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( shapeOf(_:name:) )
+MPS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0));
+
+/*!
+ *  @abstract   Create cast op and return the result tensor
+ *  @discussion Returns input tensor casted to the dataType passed in
+ *
+ *  @param      tensor        Input tensor
+ *  @param      type        Input tensor
+ *  @param      name            The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *)castTensor:(MPSGraphTensor *)tensor
+                       toType:(MPSDataType)type
+                         name:(NSString *)name
+MPS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0));
 
 @end
 
diff -ruN /Applications/Xcode_13.0.0-beta4.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTopKOps.h /Applications/Xcode_13.0.0-beta5.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTopKOps.h
--- /Applications/Xcode_13.0.0-beta4.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTopKOps.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta5.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTopKOps.h	2021-08-07 05:21:47.000000000 -0400
@@ -0,0 +1,107 @@
+//
+//  MPSGraphTopKOps.h
+//  MPSGraph
+//
+//  Created by Chris Bayley on 9/21/20.
+//  Copyright © 2020 Apple Inc. All rights reserved.
+//
+
+#ifndef MPSGraphTopKOps_h
+#define MPSGraphTopKOps_h
+
+#import <MetalPerformanceShadersGraph/MPSGraph.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+MPS_CLASS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0))
+@interface MPSGraph(MPSGraphTopKOps)
+
+/*!
+ *  @abstract   Create TopK op and return the value and indices tensors
+ *  @discussion Finds the k largest values along the minor dimension of the input. The source must have
+ *              at least k elements along its minor dimension.
+ *              The first element of the result array corresponds to the top values, and the second
+ *              array corresponds to the indices of the top values.
+ *              To perform a vertical TopK a transpose can be inserted at the minor dimension of the
+ *              incoming tensor.
+ *
+ *  @param      source   Tensor containing source data
+ *  @param      k              The number of largest values to return
+ *  @param      name        The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor array of size 2
+ */
+-(NSArray<MPSGraphTensor *> *) topKWithSourceTensor:(MPSGraphTensor *) source
+                                                  k:(NSUInteger) k
+                                               name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( topK(_:k:name:) );
+
+/*!
+ *  @abstract   Create TopK op and return the result tensor
+ *  @discussion Finds the k largest values along the minor dimension of the input. The source must have
+ *              at least k elements along its minor dimension.
+ *              The first element of the result array corresponds to the top values, and the second
+ *              array corresponds to the indices of the top values.
+ *              To perform a vertical TopK a transpose can be inserted at the minor dimension of the
+ *              incoming tensor.
+ *
+ *  @param      source     Tensor containing source data
+ *  @param      kTensor   Tensor of the number of largest values to return
+ *  @param      name          The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor array of size 2
+ */
+-(NSArray<MPSGraphTensor *> *) topKWithSourceTensor:(MPSGraphTensor *) source
+                                            kTensor:(MPSGraphTensor *) kTensor
+                                               name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( topK(_:kTensor:name:) );
+
+@end
+
+@interface MPSGraph(MPSGraphTopKGradientOps)
+
+/*!
+ *  @abstract   Create TopKGradient op and return the result tensor
+ *  @discussion Finds the K largest values along the minor dimension of the input. The input must have
+ *              at least K elements along its minor dimension.
+ *              To perform a vertical TopK a transpose can be inserted at the minor dimension of the
+ *              incoming tensor.
+ *
+ *  @param      gradient   Tensor containing the incoming gradient
+ *  @param      source        Tensor containing source data
+ *  @param      k                   The number of largest values to return
+ *  @param      name            The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) topKWithGradientTensor:(MPSGraphTensor *) gradient
+                                    source:(MPSGraphTensor *) source
+                                         k:(NSUInteger) k
+                                      name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( topKGradient(_:input:k:name:) );
+
+/*!
+ *  @abstract   Create TopKGradient op and return the result tensor
+ *  @discussion Finds the K largest values along the minor dimension of the input. The input must have
+ *              at least K elements along its minor dimension.
+ *              To perform a vertical TopK a transpose can be inserted at the minor dimension of the
+ *              incoming tensor.
+ *
+ *  @param      gradient   Tensor containing the incoming gradient
+ *  @param      source        Tensor containing source data
+ *  @param      kTensor     Tensor of the number of largest values to return
+ *  @param      name            The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) topKWithGradientTensor:(MPSGraphTensor *) gradient
+                                    source:(MPSGraphTensor *) source
+                                   kTensor:(MPSGraphTensor *) kTensor
+                                      name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( topKGradient(_:input:kTensor:name:) );
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif /* MPSGraphTopKOps_h */
diff -ruN /Applications/Xcode_13.0.0-beta4.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MetalPerformanceShadersGraph.h /Applications/Xcode_13.0.0-beta5.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MetalPerformanceShadersGraph.h
--- /Applications/Xcode_13.0.0-beta4.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MetalPerformanceShadersGraph.h	2021-07-18 18:30:44.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta5.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MetalPerformanceShadersGraph.h	2021-08-01 07:52:38.000000000 -0400
@@ -31,3 +31,4 @@
 #import <MetalPerformanceShadersGraph/MPSGraphScatterNDOps.h>
 #import <MetalPerformanceShadersGraph/MPSGraphStencilOps.h>
 #import <MetalPerformanceShadersGraph/MPSGraphTensorShapeOps.h>
+#import <MetalPerformanceShadersGraph/MPSGraphTopKOps.h>
Clone this wiki locally