Skip to content

MetalPerformanceShadersGraph tvOS xcode13.3 beta2

Alex Soto edited this page Feb 11, 2022 · 1 revision

#MetalPerformanceShadersGraph.framework

diff -ruN /Applications/Xcode_13.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphLinearAlgebraOps.h /Applications/Xcode_13.3.0-beta2.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphLinearAlgebraOps.h
--- /Applications/Xcode_13.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphLinearAlgebraOps.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.3.0-beta2.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphLinearAlgebraOps.h	2022-02-04 13:41:46.000000000 -0500
@@ -0,0 +1,64 @@
+//
+//  MPSGraphLinearAlgebraOps.h
+//  MPSGraph
+//
+//  Created by local on 1/21/22.
+//  Copyright © 2022 Apple Inc. All rights reserved.
+//
+
+#ifndef MPSGraphLinearAlgebraOps_h
+#define MPSGraphLinearAlgebraOps_h
+
+#import <MetalPerformanceShadersGraph/MPSGraph.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+
+MPS_CLASS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4))
+@interface MPSGraph(MPSGraphLinearAlgebraOps)
+
+/*!
+ *  @abstract   Create band part op and return the result
+ *  @discussion Copies a diagonal band of values from input tensor to a result tensor of the same size.
+ *              A coordinate @code [..., i, j] @endcode is in the band if
+ *              @code
+ *              (numLower < 0 || (i-j) <= numLower) && (numUpper < 0 || (j-i) <= numUpper)
+ *              @endcode
+ *              Values outside of the band are set to 0.
+ *
+ *  @param      inputTensor            The source tensor to copy
+ *  @param      numLower            The number of diagonals in the lower triangle to keep. If -1, keep all
+ *  @param      numUpper            The number of diagonals in the upper triangle to keep. If -1, keep all
+ *  @param      name            The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) bandPartWithTensor:(MPSGraphTensor *) inputTensor
+                              numLower:(NSInteger) numLower
+                              numUpper:(NSInteger) numUpper
+                                  name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( bandPart(_:numLower:numUpper:name:) );
+
+/*!
+ *  @abstract   Create band part op and return the result
+ *  @discussion See above discussion of bandPartWithTensor: numLower: numUpper: name:
+ *
+ *  @param      inputTensor            The source tensor to copy
+ *  @param      numLowerTensor            Scalar Int32 tensor. The number of diagonals in the lower triangle to keep. If -1, keep all.
+ *  @param      numUpperTensor            Scalar Int32 tensor. The number of diagonals in the upper triangle to keep. If -1, keep all.
+ *  @param      name            The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) bandPartWithTensor:(MPSGraphTensor *) inputTensor
+                        numLowerTensor:(MPSGraphTensor *) numLowerTensor
+                        numUpperTensor:(MPSGraphTensor *) numUpperTensor
+                                  name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( bandPart(_:numLowerTensor:numUpperTensor:name:) );
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+
+#endif /* MPSGraphLinearAlgebraOps_h */
diff -ruN /Applications/Xcode_13.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphRNNOps.h /Applications/Xcode_13.3.0-beta2.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphRNNOps.h
--- /Applications/Xcode_13.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphRNNOps.h	2022-01-25 13:13:24.000000000 -0500
+++ /Applications/Xcode_13.3.0-beta2.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphRNNOps.h	2022-02-04 13:41:46.000000000 -0500
@@ -20,15 +20,15 @@
  */
 typedef NS_ENUM(NSUInteger, MPSGraphRNNActivation)
 {
-    MPSGraphRNNActivationNone           MPS_ENUM_AVAILABLE_STARTING(macos(12.2), ios(15.3), tvos(15.3)) MPS_SWIFT_NAME(none)   =  0L,
-    MPSGraphRNNActivationRelu           MPS_ENUM_AVAILABLE_STARTING(macos(12.2), ios(15.3), tvos(15.3)),
-    MPSGraphRNNActivationTanh           MPS_ENUM_AVAILABLE_STARTING(macos(12.2), ios(15.3), tvos(15.3)),
-    MPSGraphRNNActivationSigmoid        MPS_ENUM_AVAILABLE_STARTING(macos(12.2), ios(15.3), tvos(15.3)),
-    MPSGraphRNNActivationHardSigmoid    MPS_ENUM_AVAILABLE_STARTING(macos(12.2), ios(15.3), tvos(15.3)),
+    MPSGraphRNNActivationNone           MPS_ENUM_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4)) MPS_SWIFT_NAME(none)   =  0L,
+    MPSGraphRNNActivationRelu           MPS_ENUM_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4)),
+    MPSGraphRNNActivationTanh           MPS_ENUM_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4)),
+    MPSGraphRNNActivationSigmoid        MPS_ENUM_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4)),
+    MPSGraphRNNActivationHardSigmoid    MPS_ENUM_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4)),
 };
 
 
-MPS_CLASS_AVAILABLE_STARTING(macos(12.2), ios(15.3), tvos(15.3))
+MPS_CLASS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4))
 @interface MPSGraphSingleGateRNNDescriptor : NSObject<NSCopying>
 
 /*!
@@ -66,7 +66,86 @@
 
 @end
 
-MPS_CLASS_AVAILABLE_STARTING(macos(12.2), ios(15.3), tvos(15.3))
+MPS_CLASS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4))
+@interface MPSGraphLSTMDescriptor : NSObject<NSCopying>
+
+/*!
+ *  @property   reverse
+ *  @discussion If set then the input sequence is passed in reverse time order to the layer.
+ *              Note: Ignored when @code bidirectional = YES @endcode.
+ *              Default value: @code NO @endcode
+ */
+@property (readwrite, nonatomic) BOOL reverse;
+
+/*!
+ *  @property   bidirectional
+ *  @discussion If set then the input sequence is traversed in both directions and the two results
+ *              are concatenated together on the channel-axis.
+ *              Default value: @code NO @endcode
+ */
+@property (readwrite, nonatomic) BOOL bidirectional;
+
+/*!
+ *  @property   produceCell
+ *  @discussion If set then this layer will produce the internal cell of the LSTM unit as secondary output.
+ *              Default value: @code NO @endcode
+ */
+@property (readwrite, nonatomic) BOOL produceCell;
+
+/*!
+ *  @property   training
+ *  @discussion If set then the layer will produce training state tensor as a secondary or third output.
+ *              Default value: @code NO @endcode
+ */
+@property (readwrite, nonatomic) BOOL training;
+
+/*!
+ *  @property   forgetGateLast
+ *  @discussion If set then the layer will use the gate-ordering `[ i, z, f, o ]` instead of default `[ i, f, z, o ]`.
+ *              Default value: @code NO @endcode
+ */
+@property (readwrite, nonatomic) BOOL forgetGateLast;
+
+/*!
+ *  @property   inputGateActivation
+ *  @discussion Activation function to use with the input gate of the LSTM  op.
+ *              Default value: @code MPSGraphRNNActivationSigmoid @endcode
+ */
+@property (readwrite, nonatomic) MPSGraphRNNActivation inputGateActivation;
+
+/*!
+ *  @property   forgetGateActivation
+ *  @discussion Activation function to use with the forget gate of the LSTM  op.
+ *              Default value: @code MPSGraphRNNActivationSigmoid @endcode
+ */
+@property (readwrite, nonatomic) MPSGraphRNNActivation forgetGateActivation;
+
+/*!
+ *  @property   cellGateActivation
+ *  @discussion Activation function to use with the cell gate of the LSTM  op.
+ *              Default value: @code MPSGraphRNNActivationTanh @endcode
+ */
+@property (readwrite, nonatomic) MPSGraphRNNActivation cellGateActivation;
+
+/*!
+ *  @property   outputGateActivation
+ *  @discussion Activation function to use with the output gate of the LSTM  op.
+ *              Default value: @code MPSGraphRNNActivationSigmoid @endcode
+ */
+@property (readwrite, nonatomic) MPSGraphRNNActivation outputGateActivation;
+
+/*!
+ *  @property   activation
+ *  @discussion Activation function to use with the current cell value of the LSTM  op.
+ *              Default value: @code MPSGraphRNNActivationTanh @endcode
+ */
+@property (readwrite, nonatomic) MPSGraphRNNActivation activation;
+
++(nullable instancetype) descriptor;
+
+@end
+
+MPS_CLASS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4))
 @interface MPSGraph(MPSGraphRNNOps)
 
 /*!
@@ -109,7 +188,7 @@
                                                   descriptor:(MPSGraphSingleGateRNNDescriptor *) descriptor
                                                         name:(NSString * _Nullable) name
 MPS_SWIFT_NAME( singleGateRNN(_:recurrentWeight:inputWeight:bias:initState:mask:descriptor:name:))
-MPS_AVAILABLE_STARTING(macos(12.2), ios(15.3), tvos(15.3));
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
 
 -(NSArray<MPSGraphTensor *> *) singleGateRNNWithSourceTensor:(MPSGraphTensor *) source
                                              recurrentWeight:(MPSGraphTensor *) recurrentWeight
@@ -119,7 +198,7 @@
                                                   descriptor:(MPSGraphSingleGateRNNDescriptor *) descriptor
                                                         name:(NSString * _Nullable) name
 MPS_SWIFT_NAME( singleGateRNN(_:recurrentWeight:inputWeight:bias:initState:descriptor:name:))
-MPS_AVAILABLE_STARTING(macos(12.2), ios(15.3), tvos(15.3));
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
 
 -(NSArray<MPSGraphTensor *> *) singleGateRNNWithSourceTensor:(MPSGraphTensor *) source
                                              recurrentWeight:(MPSGraphTensor *) recurrentWeight
@@ -127,7 +206,7 @@
                                                   descriptor:(MPSGraphSingleGateRNNDescriptor *) descriptor
                                                         name:(NSString * _Nullable) name
 MPS_SWIFT_NAME( singleGateRNN(_:recurrentWeight:initState:descriptor:name:))
-MPS_AVAILABLE_STARTING(macos(12.2), ios(15.3), tvos(15.3));
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
 
 /*!
  *  @abstract   Create a single-gate RNN gradient op and return the gradient tensor values.
@@ -168,7 +247,7 @@
                                                            descriptor:(MPSGraphSingleGateRNNDescriptor *) descriptor
                                                                  name:(NSString * _Nullable) name
 MPS_SWIFT_NAME( singleGateRNNGradients(_:recurrentWeight:sourceGradient:zState:stateGradient:inputWeight:bias:initState:mask:descriptor:name:))
-MPS_AVAILABLE_STARTING(macos(12.2), ios(15.3), tvos(15.3));
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
 
 -(NSArray<MPSGraphTensor *> *) singleGateRNNGradientsWithSourceTensor:(MPSGraphTensor *) source
                                                       recurrentWeight:(MPSGraphTensor *) recurrentWeight
@@ -181,7 +260,7 @@
                                                            descriptor:(MPSGraphSingleGateRNNDescriptor *) descriptor
                                                                  name:(NSString * _Nullable) name
 MPS_SWIFT_NAME( singleGateRNNGradients(_:recurrentWeight:sourceGradient:zState:inputWeight:bias:initState:mask:descriptor:name:))
-MPS_AVAILABLE_STARTING(macos(12.2), ios(15.3), tvos(15.3));
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
 
 -(NSArray<MPSGraphTensor *> *) singleGateRNNGradientsWithSourceTensor:(MPSGraphTensor *) source
                                                       recurrentWeight:(MPSGraphTensor *) recurrentWeight
@@ -193,7 +272,7 @@
                                                            descriptor:(MPSGraphSingleGateRNNDescriptor *) descriptor
                                                                  name:(NSString * _Nullable) name
 MPS_SWIFT_NAME( singleGateRNNGradients(_:recurrentWeight:sourceGradient:zState:inputWeight:bias:initState:descriptor:name:))
-MPS_AVAILABLE_STARTING(macos(12.2), ios(15.3), tvos(15.3));
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
 
 -(NSArray<MPSGraphTensor *> *) singleGateRNNGradientsWithSourceTensor:(MPSGraphTensor *) source
                                                       recurrentWeight:(MPSGraphTensor *) recurrentWeight
@@ -203,7 +282,168 @@
                                                            descriptor:(MPSGraphSingleGateRNNDescriptor *) descriptor
                                                                  name:(NSString * _Nullable) name
 MPS_SWIFT_NAME( singleGateRNNGradients(_:recurrentWeight:sourceGradient:zState:initState:descriptor:name:))
-MPS_AVAILABLE_STARTING(macos(12.2), ios(15.3), tvos(15.3));
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
+
+/*!
+ *  @abstract   Create a LSTM op and return the value and optionally the cell state and optionally the training state tensor.
+ *  @discussion This operation returns tensors `h` and optionally `c` and optionally `z` that are defined recursively as follows:
+ *              @code
+ *                for t = 0 to T-1
+ *                   z[t] = [i, f, z, o][t] = f( (h[t-1] m) R^T + x'[t] + p*c[t-1] )`
+ *                   x'[t] = x[t] W^T + b
+ *                   c[t] = f[t] * c[t-1] + i[t] * z[t]
+ *                   h[t] = o[t] * g(c[t]), where
+ *              @endcode
+ *              `W` is optional @ref inputWeight, `R` is @ref recurrentWeight, `b` is optional @ref bias, `m` is optional @mask,
+ *              `x[t]` is @ref source `h[t]` is the first output, `c[t]` is the second output (optional),
+ *              `z[t]` is either the second or third output (optional), `h[-1]` is @ref initCell.  and `h[-1]` is @ref initState.
+ *              `p` is an optional peephole vector.
+ *              See @ref MPSGraphLSTMDescriptor for different `activation` options for `f()` and `g()`.
+ *
+ *  @param      source                          Tensor containing the source data `x[t]` - shape should be [T,N,I].
+ *                                In case `inputWeight = nil` and `bidirectional = NO` then the layout is [T,N,4H]
+ *                                and for `inputWeight = nil` and `bidirectional = YES` the layout is [T,N,8H].
+ *  @param      recurrentWeight      Tensor containing the recurrent weights `R`.
+ *                                For `bidirectional` the layout is [2,4H,H] and otherwise it is [4H,H].
+ *  @param      inputWeight               Tensor containing the input weights matrix `W` - optional, if missing assumes diagonal unit-matrix.
+ *                                For `bidirectional` the layout is [8H,I] and otherwise it is [4H,I].
+ *  @param      bias                               Tensor containing the bias `b` - optional, if missing assumes zeroes.
+ *                                For `bidirectional` the layout is [8H] and otherwise it is [4H].
+ *  @param      initState                    Initial internal state of the LSTM `h[-1]` - optional, if missing assumes zeroes.
+ *                                For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].
+ *  @param      initCell                      Initial internal cell of the LSTM `h[-1]` - optional, if missing assumes zeroes.
+ *                                For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].
+ *  @param      mask                               Tensor containing the mask `m` - optional, if missing assumes ones. Useful for dropout.
+ *  @param      peephole                      Tensor containing the peephole vector `v` - optional, if missing assumes zeroes.
+ *                                Shape is [4H], ie. a vector for each gate, or [2,4H] for bidirectional.
+ *  @param      descriptor                  The LSTM op definition.
+ *  @param      name                               The name for the operation.
+ *
+ *  @return     A valid MPSGraphTensor array of size 1 or 2 or 3, depending on value of @ref  `descriptor.produceCell` and @ref  `descriptor.training`.
+ *              The layout of the both state and cell outputs are [T,N,H] or [T,N,2H] for bidirectional,
+ *              and the layout of the trainingState output is [T,N,4H] or [T,N,8H] for bidirectional,.
+ */
+
+-(NSArray<MPSGraphTensor *> *) LSTMWithSourceTensor:(MPSGraphTensor *) source
+                                    recurrentWeight:(MPSGraphTensor *) recurrentWeight
+                                        inputWeight:(MPSGraphTensor * _Nullable) inputWeight
+                                               bias:(MPSGraphTensor * _Nullable) bias
+                                          initState:(MPSGraphTensor * _Nullable) initState
+                                           initCell:(MPSGraphTensor * _Nullable) initCell
+                                               mask:(MPSGraphTensor * _Nullable) mask
+                                           peephole:(MPSGraphTensor * _Nullable) peephole
+                                         descriptor:(MPSGraphLSTMDescriptor *) descriptor
+                                               name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( LSTM(_:recurrentWeight:inputWeight:bias:initState:initCell:mask:peephole:descriptor:name:))
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
+
+-(NSArray<MPSGraphTensor *> *) LSTMWithSourceTensor:(MPSGraphTensor *) source
+                                    recurrentWeight:(MPSGraphTensor *) recurrentWeight
+                                        inputWeight:(MPSGraphTensor * _Nullable) inputWeight
+                                               bias:(MPSGraphTensor * _Nullable) bias
+                                          initState:(MPSGraphTensor * _Nullable) initState
+                                           initCell:(MPSGraphTensor * _Nullable) initCell
+                                         descriptor:(MPSGraphLSTMDescriptor *) descriptor
+                                               name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( LSTM(_:recurrentWeight:inputWeight:bias:initState:initCell:descriptor:name:))
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
+
+-(NSArray<MPSGraphTensor *> *) LSTMWithSourceTensor:(MPSGraphTensor *) source
+                                    recurrentWeight:(MPSGraphTensor *) recurrentWeight
+                                          initState:(MPSGraphTensor * _Nullable) initState
+                                           initCell:(MPSGraphTensor * _Nullable) initCell
+                                         descriptor:(MPSGraphLSTMDescriptor *) descriptor
+                                               name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( LSTM(_:recurrentWeight:initState:initCell:descriptor:name:))
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
+
+/*!
+ *  @abstract   Create a LSTM gradient op and return the gradient tensor values.
+ *
+ *  @param      source                          Tensor containing the source data `x[t]` - shape should be [T,N,I].
+ *                                In case `inputWeight = nil` and `bidirectional = NO` then the layout is [T,N,4H]
+ *                                and for `inputWeight = nil` and `bidirectional = YES` the layout is [T,N,8H].
+ *  @param      recurrentWeight      Tensor containing the recurrent weights `R`.
+ *                                For `bidirectional` the layout is [2,4H,H] and otherwise it is [4H,H].
+ *  @param      sourceGradient         Input gradient, that is gradient of a tensor wrt. to first output of the forward pass.
+ *  @param      cellOutputFwd           The second output of `LSTMWithSourceTensor` with @ref `descriptor.training = true` or `descriptor.produceCell = true`.
+ *  @param      zState                          The third output of `LSTMWithSourceTensor` with @ref `descriptor.training = true`.
+ *  @param      stateGradient           Input gradient for state coming from the future timestep - optional, if missing assumes zeroes.
+ *  @param      cellGradient             Input gradient for cell coming from the future timestep - optional, if missing assumes zeroes.
+ *  @param      inputWeight               Tensor containing the input weights matrix `W` - optional, if missing assumes diagonal unit-matrix.
+ *                                For `bidirectional` the layout is [8H,I] and otherwise it is [4H,I].
+ *  @param      bias                               Tensor containing the bias `b` - optional, if missing assumes zeroes.
+ *                                For `bidirectional` the layout is [8H] and otherwise it is [4H].
+ *  @param      initState                    Initial internal state of the LSTM `h[-1]` - optional, if missing assumes zeroes.
+ *                                For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].
+ *  @param      initCell                      Initial internal cell of the LSTM `h[-1]` - optional, if missing assumes zeroes.
+ *                                For `bidirectional` the layout is [N,2H] and otherwise it is [N,H].
+ *  @param      mask                               Tensor containing the mask `m` - optional, if missing assumes ones. Useful for dropout.
+ *  @param      peephole                      Tensor containing the peephole vector `v` - optional, if missing assumes zeroes. Shape is [8H], ie. a vector for each gate.
+ *  @param      descriptor                  The LSTM op definition.
+ *  @param      name                               The name for the operation.
+ *
+ *  @return     A valid MPSGraphTensor array containing gradients for each input tensor, except for `sourceGradient` and `mask`.
+ *              In case an input is nil, no gradient will be returned for it.
+ *              The order of the gradients will be: for source, for recurrentWeight, for inputWeight, for bias, for peephole, for initState, for initCell.
+ */
+
+-(NSArray<MPSGraphTensor *> *) LSTMGradientsWithSourceTensor:(MPSGraphTensor *) source
+                                             recurrentWeight:(MPSGraphTensor *) recurrentWeight
+                                              sourceGradient:(MPSGraphTensor *) sourceGradient
+                                                      zState:(MPSGraphTensor *) zState
+                                               cellOutputFwd:(MPSGraphTensor *) cellOutputFwd
+                                               stateGradient:(MPSGraphTensor * _Nullable) stateGradient
+                                                cellGradient:(MPSGraphTensor * _Nullable) cellGradient
+                                                 inputWeight:(MPSGraphTensor * _Nullable) inputWeight
+                                                        bias:(MPSGraphTensor * _Nullable) bias
+                                                   initState:(MPSGraphTensor * _Nullable) initState
+                                                    initCell:(MPSGraphTensor * _Nullable) initCell
+                                                        mask:(MPSGraphTensor * _Nullable) mask
+                                                    peephole:(MPSGraphTensor * _Nullable) peephole
+                                                  descriptor:(MPSGraphLSTMDescriptor *) descriptor
+                                                        name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( LSTMGradients(_:recurrentWeight:sourceGradient:zState:cellOutputFwd:stateGradient:cellGradient:inputWeight:bias:initState:initCell:mask:peephole:descriptor:name:))
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
+
+-(NSArray<MPSGraphTensor *> *) LSTMGradientsWithSourceTensor:(MPSGraphTensor *) source
+                                             recurrentWeight:(MPSGraphTensor *) recurrentWeight
+                                              sourceGradient:(MPSGraphTensor *) sourceGradient
+                                                      zState:(MPSGraphTensor *) zState
+                                               cellOutputFwd:(MPSGraphTensor *) cellOutputFwd
+                                                 inputWeight:(MPSGraphTensor * _Nullable) inputWeight
+                                                        bias:(MPSGraphTensor * _Nullable) bias
+                                                   initState:(MPSGraphTensor * _Nullable) initState
+                                                    initCell:(MPSGraphTensor * _Nullable) initCell
+                                                        mask:(MPSGraphTensor * _Nullable) mask
+                                                  descriptor:(MPSGraphLSTMDescriptor *) descriptor
+                                                        name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( LSTMGradients(_:recurrentWeight:sourceGradient:zState:cellOutputFwd:inputWeight:bias:initState:initCell:mask:descriptor:name:))
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
+
+-(NSArray<MPSGraphTensor *> *) LSTMGradientsWithSourceTensor:(MPSGraphTensor *) source
+                                             recurrentWeight:(MPSGraphTensor *) recurrentWeight
+                                              sourceGradient:(MPSGraphTensor *) sourceGradient
+                                                      zState:(MPSGraphTensor *) zState
+                                               cellOutputFwd:(MPSGraphTensor *) cellOutputFwd
+                                                 inputWeight:(MPSGraphTensor * _Nullable) inputWeight
+                                                        bias:(MPSGraphTensor * _Nullable) bias
+                                                   initState:(MPSGraphTensor * _Nullable) initState
+                                                    initCell:(MPSGraphTensor * _Nullable) initCell
+                                                  descriptor:(MPSGraphLSTMDescriptor *) descriptor
+                                                        name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( LSTMGradients(_:recurrentWeight:sourceGradient:zState:cellOutputFwd:inputWeight:bias:initState:initCell:descriptor:name:))
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
+
+-(NSArray<MPSGraphTensor *> *) LSTMGradientsWithSourceTensor:(MPSGraphTensor *) source
+                                             recurrentWeight:(MPSGraphTensor *) recurrentWeight
+                                              sourceGradient:(MPSGraphTensor *) sourceGradient
+                                                      zState:(MPSGraphTensor *) zState
+                                               cellOutputFwd:(MPSGraphTensor *) cellOutputFwd
+                                                  descriptor:(MPSGraphLSTMDescriptor *) descriptor
+                                                        name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( LSTMGradients(_:recurrentWeight:sourceGradient:zState:cellOutputFwd:descriptor:name:))
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
 
 @end
 
diff -ruN /Applications/Xcode_13.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorData.h /Applications/Xcode_13.3.0-beta2.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorData.h
--- /Applications/Xcode_13.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorData.h	2022-01-25 12:57:40.000000000 -0500
+++ /Applications/Xcode_13.3.0-beta2.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorData.h	2022-02-03 17:10:15.000000000 -0500
@@ -62,6 +62,21 @@
                          dataType:(MPSDataType) dataType
 MPS_SWIFT_NAME( init(_:shape:dataType:) );
 
+/*! @abstract   Initialize an MPSGraphTensorData with an MTLBuffer
+ *              The device of the MTLBuffer will be used to get the MPSDevice for this MPSGraphTensorData.
+ *  @param      buffer  MTLBuffer to be used within the MPSGraphTensorData
+ *  @param      shape  shape of the output tensor
+ *  @param      dataType  dataType of the placeholder tensor
+ *  @param      rowBytes rowBytes for the fastest moving dimension, must be larger than or equal to sizeOf(dataType) * shape[rank - 1] and must be a multiple of sizeOf(dataType)
+ *  @return     A valid MPSGraphTensorData, or nil if allocation failure.
+ */
+-(instancetype) initWithMTLBuffer:(id<MTLBuffer>) buffer
+                            shape:(MPSShape *) shape
+                         dataType:(MPSDataType) dataType
+                         rowBytes:(NSUInteger) rowBytes
+MPS_SWIFT_NAME( init(_:shape:dataType:rowBytes:) )
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
+
 /*! @abstract   Initialize an MPSGraphTensorData with an MPSMatrix
  *              The device of the MPSMatrix will be used to get the MPSDevice for this MPSGraphTensorData.
  *  @param      matrix  MPSMatrix to be used within the MPSGraphTensorData
diff -ruN /Applications/Xcode_13.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorShapeOps.h /Applications/Xcode_13.3.0-beta2.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorShapeOps.h
--- /Applications/Xcode_13.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorShapeOps.h	2022-01-25 12:57:41.000000000 -0500
+++ /Applications/Xcode_13.3.0-beta2.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorShapeOps.h	2022-02-04 13:46:13.000000000 -0500
@@ -501,6 +501,165 @@
 MPS_SWIFT_NAME( split(_:numSplits:axis:name:) )
 MPS_AVAILABLE_STARTING(macos(12.4), ios(15.4), tvos(15.4));
 
+/*!
+ *  @abstract   Create squeeze op and return the result
+ *  @discussion Squeezes the tensor, removing any dimensions with size 1.
+ *
+ *  @param      tensor        Input tensor
+ *  @param      name            The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) squeezeTensor:(MPSGraphTensor *) tensor
+                             name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( squeeze(_:name:) )
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
+
+/*!
+ *  @abstract   Create squeeze op and return the result
+ *  @discussion Squeezes the tensor, removing a dimension with size 1 at specified axis.
+ *              Size must be 1 at specified axis.
+ *
+ *  @param      tensor        Input tensor
+ *  @param      axis            The axis to squeeze
+ *  @param      name            The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) squeezeTensor:(MPSGraphTensor *) tensor
+                             axis:(NSInteger) axis
+                             name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( squeeze(_:axis:name:) )
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
+
+/*!
+ *  @abstract   Create squeeze op and return the result
+ *  @discussion Squeezes the tensor, removing dimensions with size 1 at specified axes.
+ *              Size must be 1 at all specified axes.
+ *
+ *  @param      tensor        Input tensor
+ *  @param      axes            The axes to squeeze
+ *  @param      name            The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) squeezeTensor:(MPSGraphTensor *) tensor
+                             axes:(NSArray<NSNumber *> *) axes
+                             name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( squeeze(_:axes:name:) )
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
+
+-(MPSGraphTensor *) squeezeTensor:(MPSGraphTensor *) tensor
+                       axesTensor:(MPSGraphTensor *) axesTensor
+                             name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( squeeze(_:axesTensor:name:) )
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
+
+/*!
+ *  @abstract   Create expand_dims op and return the result
+ *  @discussion Expands the tensor, inserting a dimension with size 1 at specified axis.
+ *
+ *  @param      tensor        Input tensor
+ *  @param      axis            The axis to expand
+ *  @param      name            The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) expandDimsOfTensor:(MPSGraphTensor *) tensor
+                                  axis:(NSInteger) axis
+                                  name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( expandDims(_:axis:name:) )
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
+
+/*!
+ *  @abstract   Create expand_dims op and return the result
+ *  @discussion Expands the tensor, inserting dimensions with size 1 at specified axes.
+ *
+ *  @param      tensor        Input tensor
+ *  @param      axes            The axes to expand
+ *  @param      name            The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) expandDimsOfTensor:(MPSGraphTensor *) tensor
+                                  axes:(NSArray<NSNumber *> *) axes
+                                  name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( expandDims(_:axes:name:) )
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
+
+-(MPSGraphTensor *) expandDimsOfTensor:(MPSGraphTensor *) tensor
+                            axesTensor:(MPSGraphTensor *) axesTensor
+                                  name:(NSString * _Nullable) name
+MPS_SWIFT_NAME( expandDims(_:axesTensor:name:) )
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
+
+/*!
+ *  @abstract   Create get coord op and return the result
+ *  @discussion Creates a tensor of specified shape with value at index @code [i_0, i_1, ... , i_N] = i_axis @endcode
+ *              For example,
+ *              @code
+ *              coordinateAlongAxis(0, withShape=[5]) = [0, 1, 2, 3, 4]
+ *              coordinateAlongAxis(1, withShape=[3,2]) = [[0, 0],
+ *                                                         [1, 1],
+ *                                                         [2, 2]]
+ *              @endcode
+ *
+ *  @param      axis            The coordinate axis an element's value is set to. Negative values wrap around
+ *  @param      shape           The shape of the result tensor
+ *  @param      name            The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) coordinateAlongAxis:(NSInteger) axis
+                              withShape:(MPSShape *) shape
+                                   name:(NSString * _Nullable) name
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
+
+/*!
+ *  @abstract   Create get coord op and return the result
+ *  @discussion See above discussion of getCoordinateValueWithShape: axis: name:
+ *
+ *  @param      axisTensor            Scalar Int32 tensor. The coordinate axis an element's value is set to.  Negative values wrap around
+ *  @param      shape           The shape of the result tensor
+ *  @param      name            The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) coordinateAlongAxisTensor:(MPSGraphTensor *) axisTensor
+                                    withShape:(MPSShape *) shape
+                                         name:(NSString * _Nullable) name
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
+
+/*!
+ *  @abstract   Create get coord op and return the result
+ *  @discussion See above discussion of getCoordinateValueWithShape: axis: name:
+ *
+ *  @param      axis            The coordinate axis an element's value is set to.  Negative values wrap around
+ *  @param      shapeTensor           1D Int32 or Int64 tensor. The shape of the result tensor.
+ *  @param      name            The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) coordinateAlongAxis:(NSInteger) axis
+                        withShapeTensor:(MPSGraphTensor *) shapeTensor
+                                   name:(NSString * _Nullable) name
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
+
+/*!
+ *  @abstract   Create get coord op and return the result
+ *  @discussion See above discussion of getCoordinateValueWithShape: axis: name:
+ *
+ *  @param      axisTensor            Scalar Int32 tensor. The coordinate axis an element's value is set to.  Negative values wrap around
+ *  @param      shapeTensor           1D Int32 or Int64 tensor. The shape of the result tensor.
+ *  @param      name            The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) coordinateAlongAxisTensor:(MPSGraphTensor *) axisTensor
+                              withShapeTensor:(MPSGraphTensor *) shapeTensor
+                                         name:(NSString * _Nullable) name
+MPS_AVAILABLE_STARTING(macos(12.3), ios(15.4), tvos(15.4));
+
 @end
 
 NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_13.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MetalPerformanceShadersGraph.h /Applications/Xcode_13.3.0-beta2.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MetalPerformanceShadersGraph.h
--- /Applications/Xcode_13.3.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MetalPerformanceShadersGraph.h	2022-01-21 00:12:23.000000000 -0500
+++ /Applications/Xcode_13.3.0-beta2.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MetalPerformanceShadersGraph.h	2022-01-30 16:35:20.000000000 -0500
@@ -17,6 +17,7 @@
 #import <MetalPerformanceShadersGraph/MPSGraphControlFlowOps.h>
 #import <MetalPerformanceShadersGraph/MPSGraphDepthwiseConvolutionOps.h>
 #import <MetalPerformanceShadersGraph/MPSGraphGatherOps.h>
+#import <MetalPerformanceShadersGraph/MPSGraphLinearAlgebraOps.h>
 #import <MetalPerformanceShadersGraph/MPSGraphLossOps.h>
 #import <MetalPerformanceShadersGraph/MPSGraphMatrixMultiplicationOps.h>
 #import <MetalPerformanceShadersGraph/MPSGraphSparseOps.h>
Clone this wiki locally