objc2_metal_performance_shaders_graph/generated/MPSGraphConvolutionTransposeOps.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6#[cfg(feature = "objc2-metal-performance-shaders")]
7use objc2_metal_performance_shaders::*;
8
9use crate::*;
10
11/// MPSGraphConvolutionTransposeOps.
12///
13/// This is a category that defines the methods which can be used to add 2D-convolution transpose operator to the graph with properties described by an instance of `MPSGraphConvolution2DOpDescriptor`.
14#[cfg(all(feature = "MPSGraph", feature = "MPSGraphCore"))]
15impl MPSGraph {
16 extern_methods!(
17 #[cfg(all(
18 feature = "MPSGraphConvolutionOps",
19 feature = "MPSGraphTensor",
20 feature = "objc2-metal-performance-shaders"
21 ))]
22 /// Creates a convolution transpose operation and returns the result tensor.
23 ///
24 /// Convolution Tranpose operation is exactly the same as convolution gradint with respect to input image `convolution2DDataGradientWithIncomingGradient`.
25 /// Weights tensor and source tensors are interpreted as they are in `convolution2DDataGradientWithIncomingGradient`.
26 /// Convolution with stride `s` downsamples source tensor by factor `s` in spatial dimensions whereas convolution tranpose with stride `s` upsamples
27 /// source tensor by factor `s`. Convolution transpose can map the same source size to multiple destination sizes. The relationship between the width of the
28 /// source and the width of the destination is `(sourceWidth - 1)stride + 1 + (kernelWidth - 1)dilationRate
29 /// <
30 /// = destinationWidth + paddingLeft + paddingRight`
31 /// so there are stride -1 values of the width of the destination that give same width of the source. In order to disambiguate, outputShape parameter is used.
32 ///
33 /// - Parameters:
34 /// - source: input tensor
35 /// - weights: weights tensor
36 /// - outputShape: shape of the result tensor.
37 /// - descriptor: descriptor for the corresponding forward 2D-convolution operation
38 /// - name: name for the operation
39 /// - Returns: A valid MPSGraphTensor object.
40 #[unsafe(method(convolutionTranspose2DWithSourceTensor:weightsTensor:outputShape:descriptor:name:))]
41 #[unsafe(method_family = none)]
42 pub unsafe fn convolutionTranspose2DWithSourceTensor_weightsTensor_outputShape_descriptor_name(
43 &self,
44 source: &MPSGraphTensor,
45 weights: &MPSGraphTensor,
46 output_shape: &MPSShape,
47 descriptor: &MPSGraphConvolution2DOpDescriptor,
48 name: Option<&NSString>,
49 ) -> Retained<MPSGraphTensor>;
50
51 #[cfg(all(feature = "MPSGraphConvolutionOps", feature = "MPSGraphTensor"))]
52 /// Creates a convolution transpose operation and returns the result tensor.
53 ///
54 /// - Parameters:
55 /// - source: input tensor
56 /// - weights: weights tensor
57 /// - outputShape: 1D Int32 or Int64 tensor. shape of the result tensor.
58 /// - descriptor: descriptor for the corresponding forward Conv2D operation
59 /// - name: name for the operation
60 /// - Returns: A valid MPSGraphTensor object.
61 #[unsafe(method(convolutionTranspose2DWithSourceTensor:weightsTensor:outputShapeTensor:descriptor:name:))]
62 #[unsafe(method_family = none)]
63 pub unsafe fn convolutionTranspose2DWithSourceTensor_weightsTensor_outputShapeTensor_descriptor_name(
64 &self,
65 source: &MPSGraphTensor,
66 weights: &MPSGraphTensor,
67 output_shape: &MPSGraphTensor,
68 descriptor: &MPSGraphConvolution2DOpDescriptor,
69 name: Option<&NSString>,
70 ) -> Retained<MPSGraphTensor>;
71
72 #[cfg(all(
73 feature = "MPSGraphConvolutionOps",
74 feature = "MPSGraphTensor",
75 feature = "objc2-metal-performance-shaders"
76 ))]
77 /// Creates a convolution transpose gradient operation with respect to the source tensor of convolution transpose operation and returns the result tensor.
78 ///
79 /// Inserts an operation in graph to compute gradient of convolution transpose with respect to source tensor of the corresponding
80 /// convolution transpose operation.
81 ///
82 /// - Parameters:
83 /// - incomingGradient: Incoming gradient tensor
84 /// - weights: Forward pass weights tensor
85 /// - outputShape: Shape of the forward pass source tensor
86 /// - forwardConvolutionDescriptor: Forward pass op descriptor
87 /// - name: The name for the operation.
88 /// - Returns: A valid MPSGraphTensor object
89 #[unsafe(method(convolutionTranspose2DDataGradientWithIncomingGradientTensor:weightsTensor:outputShape:forwardConvolutionDescriptor:name:))]
90 #[unsafe(method_family = none)]
91 pub unsafe fn convolutionTranspose2DDataGradientWithIncomingGradientTensor_weightsTensor_outputShape_forwardConvolutionDescriptor_name(
92 &self,
93 incoming_gradient: &MPSGraphTensor,
94 weights: &MPSGraphTensor,
95 output_shape: &MPSShape,
96 forward_convolution_descriptor: &MPSGraphConvolution2DOpDescriptor,
97 name: Option<&NSString>,
98 ) -> Retained<MPSGraphTensor>;
99
100 #[cfg(all(feature = "MPSGraphConvolutionOps", feature = "MPSGraphTensor"))]
101 /// Creates a convolution transpose gradient operation with respect to the source tensor of convolution transpose operation and returns the result tensor.
102 ///
103 /// Inserts an operation in graph to compute gradient of convolution transpose with respect to source tensor of the corresponding
104 /// convolution transpose operation.
105 ///
106 /// - Parameters:
107 /// - incomingGradient: Incoming gradient tensor
108 /// - weights: Forward pass weights tensor
109 /// - outputShape: 1D Int32 or Int64 Tensor. Shape of the forward pass source tensor
110 /// - forwardConvolutionDescriptor: Forward pass op descriptor
111 /// - name: The name for the operation.
112 /// - Returns: A valid MPSGraphTensor object
113 #[unsafe(method(convolutionTranspose2DDataGradientWithIncomingGradientTensor:weightsTensor:outputShapeTensor:forwardConvolutionDescriptor:name:))]
114 #[unsafe(method_family = none)]
115 pub unsafe fn convolutionTranspose2DDataGradientWithIncomingGradientTensor_weightsTensor_outputShapeTensor_forwardConvolutionDescriptor_name(
116 &self,
117 incoming_gradient: &MPSGraphTensor,
118 weights: &MPSGraphTensor,
119 output_shape: &MPSGraphTensor,
120 forward_convolution_descriptor: &MPSGraphConvolution2DOpDescriptor,
121 name: Option<&NSString>,
122 ) -> Retained<MPSGraphTensor>;
123
124 #[cfg(all(
125 feature = "MPSGraphConvolutionOps",
126 feature = "MPSGraphTensor",
127 feature = "objc2-metal-performance-shaders"
128 ))]
129 /// Creates a convolution transpose gradient operation with respect to the weights tensor of the convolution transpose operation and returns the result tensor.
130 ///
131 /// Inserts an operation in graph to compute gradient of convolution transpose with respect to the weights tensor of the corresponding
132 /// convolution transpose operation.
133 ///
134 /// - Parameters:
135 /// - incomingGradientTensor: Incoming gradient tensor
136 /// - source: Forward pass source tensor
137 /// - outputShape: Shape of the forward pass source weights tensor
138 /// - forwardConvolutionDescriptor: Forward pass op descriptor
139 /// - name: The name for the operation.
140 /// - Returns: A valid MPSGraphTensor object
141 #[unsafe(method(convolutionTranspose2DWeightsGradientWithIncomingGradientTensor:sourceTensor:outputShape:forwardConvolutionDescriptor:name:))]
142 #[unsafe(method_family = none)]
143 pub unsafe fn convolutionTranspose2DWeightsGradientWithIncomingGradientTensor_sourceTensor_outputShape_forwardConvolutionDescriptor_name(
144 &self,
145 incoming_gradient_tensor: &MPSGraphTensor,
146 source: &MPSGraphTensor,
147 output_shape: &MPSShape,
148 forward_convolution_descriptor: &MPSGraphConvolution2DOpDescriptor,
149 name: Option<&NSString>,
150 ) -> Retained<MPSGraphTensor>;
151
152 #[cfg(all(feature = "MPSGraphConvolutionOps", feature = "MPSGraphTensor"))]
153 /// Creates a convolution transpose gradient operation with respect to the weights tensor of the convolution transpose operation and returns the result tensor.
154 ///
155 /// Inserts an operation in graph to compute gradient of convolution transpose with respect to the weights tensor of the corresponding
156 /// convolution transpose operation.
157 ///
158 /// - Parameters:
159 /// - incomingGradientTensor: Incoming gradient tensor
160 /// - source: Forward pass source tensor
161 /// - outputShape: 1D Int32 or Int64 Tensor. Shape of the forward pass source weights tensor
162 /// - forwardConvolutionDescriptor: Forward pass op descriptor
163 /// - name: The name for the operation.
164 /// - Returns: A valid MPSGraphTensor object
165 #[unsafe(method(convolutionTranspose2DWeightsGradientWithIncomingGradientTensor:sourceTensor:outputShapeTensor:forwardConvolutionDescriptor:name:))]
166 #[unsafe(method_family = none)]
167 pub unsafe fn convolutionTranspose2DWeightsGradientWithIncomingGradientTensor_sourceTensor_outputShapeTensor_forwardConvolutionDescriptor_name(
168 &self,
169 incoming_gradient_tensor: &MPSGraphTensor,
170 source: &MPSGraphTensor,
171 output_shape: &MPSGraphTensor,
172 forward_convolution_descriptor: &MPSGraphConvolution2DOpDescriptor,
173 name: Option<&NSString>,
174 ) -> Retained<MPSGraphTensor>;
175 );
176}