objc2_metal_performance_shaders_graph/generated/
MPSGraphConvolutionOps.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7#[cfg(feature = "objc2-metal-performance-shaders")]
8use objc2_metal_performance_shaders::*;
9
10use crate::*;
11
12extern_class!(
13    /// A class that describes the properties of a 2D-convolution operator.
14    ///
15    /// Use an instance of this class is to add a 2D-convolution operator with the desired properties to the graph.
16    ///
17    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshadersgraph/mpsgraphconvolution2dopdescriptor?language=objc)
18    #[unsafe(super(MPSGraphObject, NSObject))]
19    #[derive(Debug, PartialEq, Eq, Hash)]
20    #[cfg(feature = "MPSGraphCore")]
21    pub struct MPSGraphConvolution2DOpDescriptor;
22);
23
24#[cfg(feature = "MPSGraphCore")]
25extern_conformance!(
26    unsafe impl NSCopying for MPSGraphConvolution2DOpDescriptor {}
27);
28
29#[cfg(feature = "MPSGraphCore")]
30unsafe impl CopyingHelper for MPSGraphConvolution2DOpDescriptor {
31    type Result = Self;
32}
33
34#[cfg(feature = "MPSGraphCore")]
35extern_conformance!(
36    unsafe impl NSObjectProtocol for MPSGraphConvolution2DOpDescriptor {}
37);
38
39#[cfg(feature = "MPSGraphCore")]
40impl MPSGraphConvolution2DOpDescriptor {
41    extern_methods!(
42        /// The scale that maps `x`-coordinate of the destination to `x`-coordinate of the source.
43        ///
44        /// Source `x`-coordinate, `sx` is computed from destination `x`-coordinate, `dx` as `sx = strideInX*dx`.
45        /// Default value is 1.
46        #[unsafe(method(strideInX))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn strideInX(&self) -> NSUInteger;
49
50        /// Setter for [`strideInX`][Self::strideInX].
51        #[unsafe(method(setStrideInX:))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn setStrideInX(&self, stride_in_x: NSUInteger);
54
55        /// The scale that maps `y`-coordinate of the destination to `y`-coordinate of the source.
56        ///
57        /// Source `y`-coordinate, `sy` is computed from destination `y`-coordinate, `dy` as `sy = strideInY*dy`.
58        /// Default value is 1.
59        #[unsafe(method(strideInY))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn strideInY(&self) -> NSUInteger;
62
63        /// Setter for [`strideInY`][Self::strideInY].
64        #[unsafe(method(setStrideInY:))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn setStrideInY(&self, stride_in_y: NSUInteger);
67
68        /// The amount by which the weights tensor expands in the `x`-direction.
69        ///
70        /// The weights tensor is dilated by inserting `dilationRateInX-1` zeros between consecutive values in `x`-dimension.
71        /// Dilated weights tensor width is `(dilationRateInX-1)*kernelWidth+1`.
72        /// Default value is 1.
73        #[unsafe(method(dilationRateInX))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn dilationRateInX(&self) -> NSUInteger;
76
77        /// Setter for [`dilationRateInX`][Self::dilationRateInX].
78        #[unsafe(method(setDilationRateInX:))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn setDilationRateInX(&self, dilation_rate_in_x: NSUInteger);
81
82        /// The amount by which the weights tensor expands in the `y`-direction.
83        ///
84        /// The weights tensor is dilated by inserting `dilationRateInY-1` zeros between consecutive values in `y`-dimension.
85        /// Dilated weights tensor width is `(dilationRateInY-1)*kernelHeight+1`.
86        /// Default value is 1.
87        #[unsafe(method(dilationRateInY))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn dilationRateInY(&self) -> NSUInteger;
90
91        /// Setter for [`dilationRateInY`][Self::dilationRateInY].
92        #[unsafe(method(setDilationRateInY:))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn setDilationRateInY(&self, dilation_rate_in_y: NSUInteger);
95
96        /// The number of zeros added on the left side of the source tensor.
97        #[unsafe(method(paddingLeft))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn paddingLeft(&self) -> NSUInteger;
100
101        /// Setter for [`paddingLeft`][Self::paddingLeft].
102        #[unsafe(method(setPaddingLeft:))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn setPaddingLeft(&self, padding_left: NSUInteger);
105
106        /// The number of zeros added on the right side of the source tensor.
107        #[unsafe(method(paddingRight))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn paddingRight(&self) -> NSUInteger;
110
111        /// Setter for [`paddingRight`][Self::paddingRight].
112        #[unsafe(method(setPaddingRight:))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn setPaddingRight(&self, padding_right: NSUInteger);
115
116        /// The number of zeros added at the top of the source tensor.
117        #[unsafe(method(paddingTop))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn paddingTop(&self) -> NSUInteger;
120
121        /// Setter for [`paddingTop`][Self::paddingTop].
122        #[unsafe(method(setPaddingTop:))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn setPaddingTop(&self, padding_top: NSUInteger);
125
126        /// The number of zeros added at the bottom of the source tensor.
127        #[unsafe(method(paddingBottom))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn paddingBottom(&self) -> NSUInteger;
130
131        /// Setter for [`paddingBottom`][Self::paddingBottom].
132        #[unsafe(method(setPaddingBottom:))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn setPaddingBottom(&self, padding_bottom: NSUInteger);
135
136        /// The type of padding applied to the source tensor.
137        ///
138        /// If paddingStyle is `MPSGraphPaddingStyleExplicit`, `paddingLeft`, `laddingRight`, `paddingTop`,
139        /// and `paddingBottom` must to be specified. For all other padding styles, framework compute these values so you dont need to provide these values.
140        #[unsafe(method(paddingStyle))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn paddingStyle(&self) -> MPSGraphPaddingStyle;
143
144        /// Setter for [`paddingStyle`][Self::paddingStyle].
145        #[unsafe(method(setPaddingStyle:))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn setPaddingStyle(&self, padding_style: MPSGraphPaddingStyle);
148
149        /// The named layout of data in the source tensor.
150        ///
151        /// It defines the order of named dimensions (Batch, Channel, Height, Width). The convolution operation uses this to interpret data in the source tensor.
152        /// For example, if `dataLayout` is `MPSGraphTensorNamedDataLayoutNCHW`, frameork interprets data in source tensor as `batch x channels x height x width`
153        /// with `width` as fastest moving dimension.
154        #[unsafe(method(dataLayout))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn dataLayout(&self) -> MPSGraphTensorNamedDataLayout;
157
158        /// Setter for [`dataLayout`][Self::dataLayout].
159        #[unsafe(method(setDataLayout:))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn setDataLayout(&self, data_layout: MPSGraphTensorNamedDataLayout);
162
163        /// The named layout of data in the weights tensor.
164        ///
165        /// It defines the order of named dimensions (Output channels, Input channels, Kernel height, Kernel width). The convolution operation uses this to interpret data in the weights tensor.
166        /// For example, if `weightsLayout` is `MPSGraphTensorNamedDataLayoutOIHW`, frameork interprets data in weights tensor as `outputChannels x inputChannels x kernelHeight x kernelWidth`
167        /// with `kernelWidth` as fastest moving dimension.
168        #[unsafe(method(weightsLayout))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn weightsLayout(&self) -> MPSGraphTensorNamedDataLayout;
171
172        /// Setter for [`weightsLayout`][Self::weightsLayout].
173        #[unsafe(method(setWeightsLayout:))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn setWeightsLayout(&self, weights_layout: MPSGraphTensorNamedDataLayout);
176
177        /// The number of partitions of the input and output channels.
178        ///
179        /// The convolution operation divides input and output channels in `groups` partitions.
180        /// input channels in a group or partition are only connected to output channels in corresponding group.
181        /// Number of weights the convolution needs is `outputFeatureChannels x inputFeatureChannels/groups x kernelWidth x kernelHeight`
182        #[unsafe(method(groups))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn groups(&self) -> NSUInteger;
185
186        /// Setter for [`groups`][Self::groups].
187        #[unsafe(method(setGroups:))]
188        #[unsafe(method_family = none)]
189        pub unsafe fn setGroups(&self, groups: NSUInteger);
190
191        /// Creates a convolution descriptor with given values for parameters.
192        /// - Parameters:
193        /// - strideInX: See ``strideInX`` property.
194        /// - strideInY: See ``strideInY`` property.
195        /// - dilationRateInX: See ``dilationRateInX`` property.
196        /// - dilationRateInY: See ``dilationRateInY`` property.
197        /// - groups: See ``groups`` property.
198        /// - paddingLeft: See ``paddingLeft`` property.
199        /// - paddingRight: See ``paddingRight`` property.
200        /// - paddingTop: See ``paddingTop`` property.
201        /// - paddingBottom: See ``paddingBottom`` property.
202        /// - paddingStyle: See ``paddingStyle`` property.
203        /// - dataLayout: See ``dataLayout`` property.
204        /// - weightsLayout: See ``weightsLayout`` property.
205        /// - Returns: The `MPSGraphConvolution2DOpDescriptor` on autoreleasepool.
206        #[unsafe(method(descriptorWithStrideInX:strideInY:dilationRateInX:dilationRateInY:groups:paddingLeft:paddingRight:paddingTop:paddingBottom:paddingStyle:dataLayout:weightsLayout:))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn descriptorWithStrideInX_strideInY_dilationRateInX_dilationRateInY_groups_paddingLeft_paddingRight_paddingTop_paddingBottom_paddingStyle_dataLayout_weightsLayout(
209            stride_in_x: NSUInteger,
210            stride_in_y: NSUInteger,
211            dilation_rate_in_x: NSUInteger,
212            dilation_rate_in_y: NSUInteger,
213            groups: NSUInteger,
214            padding_left: NSUInteger,
215            padding_right: NSUInteger,
216            padding_top: NSUInteger,
217            padding_bottom: NSUInteger,
218            padding_style: MPSGraphPaddingStyle,
219            data_layout: MPSGraphTensorNamedDataLayout,
220            weights_layout: MPSGraphTensorNamedDataLayout,
221        ) -> Option<Retained<Self>>;
222
223        /// Creates a convolution descriptor with given values for parameters.
224        /// - Parameters:
225        /// - strideInX: See ``strideInX`` property.
226        /// - strideInY: See ``strideInY`` property.
227        /// - dilationRateInX: See ``dilationRateInX`` property.
228        /// - dilationRateInY: See ``dilationRateInY`` property.
229        /// - groups: See ``groups`` property.
230        /// - paddingStyle: See ``paddingStyle`` property.
231        /// - dataLayout: See ``dataLayout`` property.
232        /// - weightsLayout: See ``weightsLayout`` property.
233        /// - Returns: The `MPSGraphConvolution2DOpDescriptor` on autoreleasepool.
234        #[unsafe(method(descriptorWithStrideInX:strideInY:dilationRateInX:dilationRateInY:groups:paddingStyle:dataLayout:weightsLayout:))]
235        #[unsafe(method_family = none)]
236        pub unsafe fn descriptorWithStrideInX_strideInY_dilationRateInX_dilationRateInY_groups_paddingStyle_dataLayout_weightsLayout(
237            stride_in_x: NSUInteger,
238            stride_in_y: NSUInteger,
239            dilation_rate_in_x: NSUInteger,
240            dilation_rate_in_y: NSUInteger,
241            groups: NSUInteger,
242            padding_style: MPSGraphPaddingStyle,
243            data_layout: MPSGraphTensorNamedDataLayout,
244            weights_layout: MPSGraphTensorNamedDataLayout,
245        ) -> Option<Retained<Self>>;
246
247        /// Sets the left, right, top, and bottom padding values.
248        /// - Parameters:
249        /// - paddingLeft: See ``paddingLeft`` property.
250        /// - paddingRight: See ``paddingRight`` property.
251        /// - paddingTop: See ``paddingTop`` property.
252        /// - paddingBottom: See ``paddingBottom`` property.
253        #[unsafe(method(setExplicitPaddingWithPaddingLeft:paddingRight:paddingTop:paddingBottom:))]
254        #[unsafe(method_family = none)]
255        pub unsafe fn setExplicitPaddingWithPaddingLeft_paddingRight_paddingTop_paddingBottom(
256            &self,
257            padding_left: NSUInteger,
258            padding_right: NSUInteger,
259            padding_top: NSUInteger,
260            padding_bottom: NSUInteger,
261        );
262    );
263}
264
265/// Methods declared on superclass `NSObject`.
266#[cfg(feature = "MPSGraphCore")]
267impl MPSGraphConvolution2DOpDescriptor {
268    extern_methods!(
269        #[unsafe(method(init))]
270        #[unsafe(method_family = init)]
271        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
272
273        #[unsafe(method(new))]
274        #[unsafe(method_family = new)]
275        pub unsafe fn new() -> Retained<Self>;
276    );
277}
278
279extern_class!(
280    /// A class that describes the properties of a 3D-convolution operator.
281    ///
282    /// Use an instance of this class is to add a 3D-convolution operator with desired properties to the graph.
283    ///
284    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshadersgraph/mpsgraphconvolution3dopdescriptor?language=objc)
285    #[unsafe(super(MPSGraphObject, NSObject))]
286    #[derive(Debug, PartialEq, Eq, Hash)]
287    #[cfg(feature = "MPSGraphCore")]
288    pub struct MPSGraphConvolution3DOpDescriptor;
289);
290
291#[cfg(feature = "MPSGraphCore")]
292extern_conformance!(
293    unsafe impl NSCopying for MPSGraphConvolution3DOpDescriptor {}
294);
295
296#[cfg(feature = "MPSGraphCore")]
297unsafe impl CopyingHelper for MPSGraphConvolution3DOpDescriptor {
298    type Result = Self;
299}
300
301#[cfg(feature = "MPSGraphCore")]
302extern_conformance!(
303    unsafe impl NSObjectProtocol for MPSGraphConvolution3DOpDescriptor {}
304);
305
306#[cfg(feature = "MPSGraphCore")]
307impl MPSGraphConvolution3DOpDescriptor {
308    extern_methods!(
309        /// The scale that maps`x`-coordinate of destination to `x`-coordinate of source.
310        ///
311        /// Source `x`-coordinate, `sx` is computed from destination `x`-coordinate, `dx` as `sx = strideInX*dx`.
312        /// Default value is 1.
313        #[unsafe(method(strideInX))]
314        #[unsafe(method_family = none)]
315        pub unsafe fn strideInX(&self) -> NSUInteger;
316
317        /// Setter for [`strideInX`][Self::strideInX].
318        #[unsafe(method(setStrideInX:))]
319        #[unsafe(method_family = none)]
320        pub unsafe fn setStrideInX(&self, stride_in_x: NSUInteger);
321
322        /// The scale that maps`y`-coordinate of destination to `y`-coordinate of source.
323        ///
324        /// Source `y`-coordinate, `sy` is computed from destination `y`-coordinate, `dy` as `sy = strideInY*dy`.
325        /// Default value is 1.
326        #[unsafe(method(strideInY))]
327        #[unsafe(method_family = none)]
328        pub unsafe fn strideInY(&self) -> NSUInteger;
329
330        /// Setter for [`strideInY`][Self::strideInY].
331        #[unsafe(method(setStrideInY:))]
332        #[unsafe(method_family = none)]
333        pub unsafe fn setStrideInY(&self, stride_in_y: NSUInteger);
334
335        /// The scale that maps`z`-coordinate of destination to `z`-coordinate of source.
336        ///
337        /// Source `z`-coordinate, `sz` is computed from destination `z`-coordinate, `dz` as `sz = strideInZ*dz`.
338        /// Default value is 1.
339        #[unsafe(method(strideInZ))]
340        #[unsafe(method_family = none)]
341        pub unsafe fn strideInZ(&self) -> NSUInteger;
342
343        /// Setter for [`strideInZ`][Self::strideInZ].
344        #[unsafe(method(setStrideInZ:))]
345        #[unsafe(method_family = none)]
346        pub unsafe fn setStrideInZ(&self, stride_in_z: NSUInteger);
347
348        /// The amount by which weights tensor expands in the `x`-direction.
349        ///
350        /// The weights tensor is dilated by inserting `dilationRateInX-1` zeros between consecutive values in `x`-dimension.
351        /// Dilated weights tensor width is `(dilationRateInX-1)*kernelWidth+1`.
352        /// Default value is 1.
353        #[unsafe(method(dilationRateInX))]
354        #[unsafe(method_family = none)]
355        pub unsafe fn dilationRateInX(&self) -> NSUInteger;
356
357        /// Setter for [`dilationRateInX`][Self::dilationRateInX].
358        #[unsafe(method(setDilationRateInX:))]
359        #[unsafe(method_family = none)]
360        pub unsafe fn setDilationRateInX(&self, dilation_rate_in_x: NSUInteger);
361
362        /// The amount by which weights tensor expands in the `y`-direction.
363        ///
364        /// The weights tensor is dilated by inserting `dilationRateInY-1` zeros between consecutive values in `y`-dimension.
365        /// Dilated weights tensor width is `(dilationRateInY-1)*kernelHeight+1`.
366        /// Default value is 1.
367        #[unsafe(method(dilationRateInY))]
368        #[unsafe(method_family = none)]
369        pub unsafe fn dilationRateInY(&self) -> NSUInteger;
370
371        /// Setter for [`dilationRateInY`][Self::dilationRateInY].
372        #[unsafe(method(setDilationRateInY:))]
373        #[unsafe(method_family = none)]
374        pub unsafe fn setDilationRateInY(&self, dilation_rate_in_y: NSUInteger);
375
376        /// The amount by which weights tensor expands in the `z`-direction.
377        ///
378        /// The weights tensor is dilated by inserting `dilationRateInZ-1` zeros between consecutive values in `z`-dimension.
379        /// Dilated weights tensor depth is `(dilationRateInZ-1)*kernelDepth+1`.
380        /// Default value is 1.
381        #[unsafe(method(dilationRateInZ))]
382        #[unsafe(method_family = none)]
383        pub unsafe fn dilationRateInZ(&self) -> NSUInteger;
384
385        /// Setter for [`dilationRateInZ`][Self::dilationRateInZ].
386        #[unsafe(method(setDilationRateInZ:))]
387        #[unsafe(method_family = none)]
388        pub unsafe fn setDilationRateInZ(&self, dilation_rate_in_z: NSUInteger);
389
390        /// The number of zeros added on the left side of the source tensor.
391        #[unsafe(method(paddingLeft))]
392        #[unsafe(method_family = none)]
393        pub unsafe fn paddingLeft(&self) -> NSUInteger;
394
395        /// Setter for [`paddingLeft`][Self::paddingLeft].
396        #[unsafe(method(setPaddingLeft:))]
397        #[unsafe(method_family = none)]
398        pub unsafe fn setPaddingLeft(&self, padding_left: NSUInteger);
399
400        /// The number of zeros added on the right side of the source tensor.
401        #[unsafe(method(paddingRight))]
402        #[unsafe(method_family = none)]
403        pub unsafe fn paddingRight(&self) -> NSUInteger;
404
405        /// Setter for [`paddingRight`][Self::paddingRight].
406        #[unsafe(method(setPaddingRight:))]
407        #[unsafe(method_family = none)]
408        pub unsafe fn setPaddingRight(&self, padding_right: NSUInteger);
409
410        /// The number of zeros added at the top of the source tensor.
411        #[unsafe(method(paddingTop))]
412        #[unsafe(method_family = none)]
413        pub unsafe fn paddingTop(&self) -> NSUInteger;
414
415        /// Setter for [`paddingTop`][Self::paddingTop].
416        #[unsafe(method(setPaddingTop:))]
417        #[unsafe(method_family = none)]
418        pub unsafe fn setPaddingTop(&self, padding_top: NSUInteger);
419
420        /// The number of zeros added at the bottom of the source tensor.
421        #[unsafe(method(paddingBottom))]
422        #[unsafe(method_family = none)]
423        pub unsafe fn paddingBottom(&self) -> NSUInteger;
424
425        /// Setter for [`paddingBottom`][Self::paddingBottom].
426        #[unsafe(method(setPaddingBottom:))]
427        #[unsafe(method_family = none)]
428        pub unsafe fn setPaddingBottom(&self, padding_bottom: NSUInteger);
429
430        /// The number of zeros added at the front of the source tensor.
431        #[unsafe(method(paddingFront))]
432        #[unsafe(method_family = none)]
433        pub unsafe fn paddingFront(&self) -> NSUInteger;
434
435        /// Setter for [`paddingFront`][Self::paddingFront].
436        #[unsafe(method(setPaddingFront:))]
437        #[unsafe(method_family = none)]
438        pub unsafe fn setPaddingFront(&self, padding_front: NSUInteger);
439
440        /// The number of zeros added at the back of the source tensor.
441        #[unsafe(method(paddingBack))]
442        #[unsafe(method_family = none)]
443        pub unsafe fn paddingBack(&self) -> NSUInteger;
444
445        /// Setter for [`paddingBack`][Self::paddingBack].
446        #[unsafe(method(setPaddingBack:))]
447        #[unsafe(method_family = none)]
448        pub unsafe fn setPaddingBack(&self, padding_back: NSUInteger);
449
450        /// The type of padding that is applied to the source tensor.
451        ///
452        /// If paddingStyle is `MPSGraphPaddingStyleExplicit`, `paddingLeft`, `laddingRight`, `paddingTop`,
453        /// `paddingBottom`,   `paddingFront` and `paddingBack` must to be specified. For all other padding styles, framework compute these values so you dont need to provide these values.
454        #[unsafe(method(paddingStyle))]
455        #[unsafe(method_family = none)]
456        pub unsafe fn paddingStyle(&self) -> MPSGraphPaddingStyle;
457
458        /// Setter for [`paddingStyle`][Self::paddingStyle].
459        #[unsafe(method(setPaddingStyle:))]
460        #[unsafe(method_family = none)]
461        pub unsafe fn setPaddingStyle(&self, padding_style: MPSGraphPaddingStyle);
462
463        /// The named layout of data in the source tensor.
464        ///
465        /// It defines the order of named dimensions (Batch, Channel, Depth, Height, Width). The convolution operation uses this to interpret data in the source tensor.
466        /// For example, if `dataLayout` is `MPSGraphTensorNamedDataLayoutNCDHW`, frameork interprets data in source tensor as `batch x channels x depth x height x width`
467        /// with `width` as fastest moving dimension.
468        #[unsafe(method(dataLayout))]
469        #[unsafe(method_family = none)]
470        pub unsafe fn dataLayout(&self) -> MPSGraphTensorNamedDataLayout;
471
472        /// Setter for [`dataLayout`][Self::dataLayout].
473        #[unsafe(method(setDataLayout:))]
474        #[unsafe(method_family = none)]
475        pub unsafe fn setDataLayout(&self, data_layout: MPSGraphTensorNamedDataLayout);
476
477        /// The named layout of data in the weights tensor.
478        ///
479        /// It defines the order of named dimensions (Output channels, Input channels, Kernel depth, Kernel height, Kernel width). The convolution operation uses this to interpret data in the weights tensor.
480        /// For example, if `weightsLayout` is `MPSGraphTensorNamedDataLayoutOIDHW`, frameork interprets data in weights tensor as `outputChannels x inputChannels x kernelDepth x kernelHeight x kernelWidth`
481        /// with `kernelWidth` as fastest moving dimension.
482        #[unsafe(method(weightsLayout))]
483        #[unsafe(method_family = none)]
484        pub unsafe fn weightsLayout(&self) -> MPSGraphTensorNamedDataLayout;
485
486        /// Setter for [`weightsLayout`][Self::weightsLayout].
487        #[unsafe(method(setWeightsLayout:))]
488        #[unsafe(method_family = none)]
489        pub unsafe fn setWeightsLayout(&self, weights_layout: MPSGraphTensorNamedDataLayout);
490
491        /// The number of partitions of the input and output channels.
492        ///
493        /// The convolution operation divides input and output channels in `groups` partitions.
494        /// input channels in a group or partition are only connected to output channels in corresponding group.
495        /// Number of weights the convolution needs is `outputFeatureChannels x inputFeatureChannels/groups x kernelDepth x kernelWidth x kernelHeight`
496        #[unsafe(method(groups))]
497        #[unsafe(method_family = none)]
498        pub unsafe fn groups(&self) -> NSUInteger;
499
500        /// Setter for [`groups`][Self::groups].
501        #[unsafe(method(setGroups:))]
502        #[unsafe(method_family = none)]
503        pub unsafe fn setGroups(&self, groups: NSUInteger);
504
505        /// Creates a convolution descriptor with given values for parameters.
506        /// - Parameters:
507        /// - strideInX: See ``strideInX`` property.
508        /// - strideInY: See ``strideInY`` property.
509        /// - strideInZ: See ``strideInZ`` property.
510        /// - dilationRateInX: See ``dilationRateInX`` property.
511        /// - dilationRateInY: See ``dilationRateInY`` property.
512        /// - dilationRateInZ: See ``dilationRateInZ`` property.
513        /// - groups: See ``groups`` property.
514        /// - paddingLeft: See ``paddingLeft`` property.
515        /// - paddingRight: See ``paddingRight`` property.
516        /// - paddingTop: See ``paddingTop`` property.
517        /// - paddingBottom: See ``paddingBottom`` property.
518        /// - paddingFront: See ``paddingFront`` property.
519        /// - paddingBack: See ``paddingBack`` property.
520        /// - paddingStyle: See ``paddingStyle`` property.
521        /// - dataLayout: See ``dataLayout`` property.
522        /// - weightsLayout: See ``weightsLayout`` property.
523        /// - Returns: The `MPSGraphConvolution3DOpDescriptor` on autoreleasepool.
524        #[unsafe(method(descriptorWithStrideInX:strideInY:strideInZ:dilationRateInX:dilationRateInY:dilationRateInZ:groups:paddingLeft:paddingRight:paddingTop:paddingBottom:paddingFront:paddingBack:paddingStyle:dataLayout:weightsLayout:))]
525        #[unsafe(method_family = none)]
526        pub unsafe fn descriptorWithStrideInX_strideInY_strideInZ_dilationRateInX_dilationRateInY_dilationRateInZ_groups_paddingLeft_paddingRight_paddingTop_paddingBottom_paddingFront_paddingBack_paddingStyle_dataLayout_weightsLayout(
527            stride_in_x: NSUInteger,
528            stride_in_y: NSUInteger,
529            stride_in_z: NSUInteger,
530            dilation_rate_in_x: NSUInteger,
531            dilation_rate_in_y: NSUInteger,
532            dilation_rate_in_z: NSUInteger,
533            groups: NSUInteger,
534            padding_left: NSUInteger,
535            padding_right: NSUInteger,
536            padding_top: NSUInteger,
537            padding_bottom: NSUInteger,
538            padding_front: NSUInteger,
539            padding_back: NSUInteger,
540            padding_style: MPSGraphPaddingStyle,
541            data_layout: MPSGraphTensorNamedDataLayout,
542            weights_layout: MPSGraphTensorNamedDataLayout,
543        ) -> Option<Retained<Self>>;
544
545        /// Creates a convolution descriptor with given values for parameters.
546        /// - Parameters:
547        /// - strideInX: See ``strideInX`` property.
548        /// - strideInY: See ``strideInY`` property.
549        /// - strideInZ: See ``strideInZ`` property.
550        /// - dilationRateInX: See ``dilationRateInX`` property.
551        /// - dilationRateInY: See ``dilationRateInY`` property.
552        /// - dilationRateInZ: See ``dilationRateInZ`` property.
553        /// - groups: See ``groups`` property.
554        /// - paddingStyle: See ``paddingStyle`` property.
555        /// - dataLayout: See ``dataLayout`` property.
556        /// - weightsLayout: See ``weightsLayout`` property.
557        /// - Returns: The `MPSGraphConvolution3DOpDescriptor` on autoreleasepool.
558        #[unsafe(method(descriptorWithStrideInX:strideInY:strideInZ:dilationRateInX:dilationRateInY:dilationRateInZ:groups:paddingStyle:dataLayout:weightsLayout:))]
559        #[unsafe(method_family = none)]
560        pub unsafe fn descriptorWithStrideInX_strideInY_strideInZ_dilationRateInX_dilationRateInY_dilationRateInZ_groups_paddingStyle_dataLayout_weightsLayout(
561            stride_in_x: NSUInteger,
562            stride_in_y: NSUInteger,
563            stride_in_z: NSUInteger,
564            dilation_rate_in_x: NSUInteger,
565            dilation_rate_in_y: NSUInteger,
566            dilation_rate_in_z: NSUInteger,
567            groups: NSUInteger,
568            padding_style: MPSGraphPaddingStyle,
569            data_layout: MPSGraphTensorNamedDataLayout,
570            weights_layout: MPSGraphTensorNamedDataLayout,
571        ) -> Option<Retained<Self>>;
572
573        /// Sets the left, right, top, bottom, front, and back padding values.
574        /// - Parameters:
575        /// - paddingLeft: See ``paddingLeft`` property.
576        /// - paddingRight: See ``paddingRight`` property.
577        /// - paddingTop: See ``paddingTop`` property.
578        /// - paddingBottom: See ``paddingBottom`` property.
579        /// - paddingFront: See ``paddingFront`` property.
580        /// - paddingBottom: See ``paddingBottom`` property.
581        #[unsafe(method(setExplicitPaddingWithPaddingLeft:paddingRight:paddingTop:paddingBottom:paddingFront:paddingBack:))]
582        #[unsafe(method_family = none)]
583        pub unsafe fn setExplicitPaddingWithPaddingLeft_paddingRight_paddingTop_paddingBottom_paddingFront_paddingBack(
584            &self,
585            padding_left: NSUInteger,
586            padding_right: NSUInteger,
587            padding_top: NSUInteger,
588            padding_bottom: NSUInteger,
589            padding_front: NSUInteger,
590            padding_back: NSUInteger,
591        );
592    );
593}
594
595/// Methods declared on superclass `NSObject`.
596#[cfg(feature = "MPSGraphCore")]
597impl MPSGraphConvolution3DOpDescriptor {
598    extern_methods!(
599        #[unsafe(method(init))]
600        #[unsafe(method_family = init)]
601        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
602
603        #[unsafe(method(new))]
604        #[unsafe(method_family = new)]
605        pub unsafe fn new() -> Retained<Self>;
606    );
607}
608
609/// MPSGraphConvolutionOps.
610///
611/// This is a category that defines the methods which can be used to add 2D-convolution operator to the graph with properties described by an instance of `MPSGraphConvolution2DOpDescriptor`.
612#[cfg(all(feature = "MPSGraph", feature = "MPSGraphCore"))]
613impl MPSGraph {
614    extern_methods!(
615        #[cfg(feature = "MPSGraphTensor")]
616        /// Creates a 2D (forward) convolution operation and returns the result tensor.
617        ///
618        /// - Parameters:
619        /// - source: source tensor - must be a rank 4 tensor. The layout is defined by ``descriptor.dataLayout``.
620        /// - weights: weights tensor, must be rank 4. The layout is defined by ``descriptor.weightsLayout``.
621        /// - descriptor: Specifies strides, dilation rates, paddings and layouts.
622        /// - name: The name for the operation.
623        /// - Returns: A valid MPSGraphTensor object
624        #[unsafe(method(convolution2DWithSourceTensor:weightsTensor:descriptor:name:))]
625        #[unsafe(method_family = none)]
626        pub unsafe fn convolution2DWithSourceTensor_weightsTensor_descriptor_name(
627            &self,
628            source: &MPSGraphTensor,
629            weights: &MPSGraphTensor,
630            descriptor: &MPSGraphConvolution2DOpDescriptor,
631            name: Option<&NSString>,
632        ) -> Retained<MPSGraphTensor>;
633
634        #[cfg(all(
635            feature = "MPSGraphTensor",
636            feature = "objc2-metal-performance-shaders"
637        ))]
638        /// Creates a 2D convolution gradient operation with respect to the source tensor of the forward convolution.
639        ///
640        /// If `S` is source tensor to forward convolution, `R` is the result/returned tensor from forward convolution,
641        /// and `L` is the loss function, `convolution2DDataGradientWithIncomingGradientTensor` returns tensor `dL/dS = dL/dR * dR/dS`,
642        /// where `dL/dR` is the incomingGradient parameter.
643        ///
644        /// - Parameters:
645        /// - incomingGradient: Incoming loss gradient tensor
646        /// - weights: Forward pass weights tensor
647        /// - outputShape: Shape of the forward pass source tensor
648        /// - forwardConvolutionDescriptor: Forward convolution 2D op ``descriptor``
649        /// - name: The name for the operation.
650        /// - Returns: A valid MPSGraphTensor object
651        #[unsafe(method(convolution2DDataGradientWithIncomingGradientTensor:weightsTensor:outputShape:forwardConvolutionDescriptor:name:))]
652        #[unsafe(method_family = none)]
653        pub unsafe fn convolution2DDataGradientWithIncomingGradientTensor_weightsTensor_outputShape_forwardConvolutionDescriptor_name(
654            &self,
655            incoming_gradient: &MPSGraphTensor,
656            weights: &MPSGraphTensor,
657            output_shape: &MPSShape,
658            forward_convolution_descriptor: &MPSGraphConvolution2DOpDescriptor,
659            name: Option<&NSString>,
660        ) -> Retained<MPSGraphTensor>;
661
662        #[cfg(feature = "MPSGraphTensor")]
663        /// Creates a 2D convolution gradient operation with respect to the source tensor of the forward convolution.
664        ///
665        /// If `S` is source tensor to forward convolution, `R` is the result/returned tensor of forward convolution,
666        /// and `L` is the loss function, convolution2DDataGradientWithIncomingGradientTensor returns tensor `dL/dS = dL/dR * dR/dS`,
667        /// where `dL/dR` is the incomingGradient parameter.
668        ///
669        /// - Parameters:
670        /// - incomingGradient: Incoming loss gradient tensor
671        /// - weights: Forward pass weights tensor
672        /// - outputShapeTensor: 4D Int32 or Int64 tensor. Shape of the forward pass source tensor
673        /// - forwardConvolutionDescriptor: Forward convolution 2D op ``descriptor``
674        /// - name: The name for the operation.
675        /// - Returns: A valid MPSGraphTensor object
676        #[unsafe(method(convolution2DDataGradientWithIncomingGradientTensor:weightsTensor:outputShapeTensor:forwardConvolutionDescriptor:name:))]
677        #[unsafe(method_family = none)]
678        pub unsafe fn convolution2DDataGradientWithIncomingGradientTensor_weightsTensor_outputShapeTensor_forwardConvolutionDescriptor_name(
679            &self,
680            gradient: &MPSGraphTensor,
681            weights: &MPSGraphTensor,
682            output_shape_tensor: &MPSGraphTensor,
683            forward_convolution_descriptor: &MPSGraphConvolution2DOpDescriptor,
684            name: Option<&NSString>,
685        ) -> Retained<MPSGraphTensor>;
686
687        #[cfg(all(
688            feature = "MPSGraphTensor",
689            feature = "objc2-metal-performance-shaders"
690        ))]
691        /// Creates a 2D convolution gradient operation with respect to the weights tensor of the forward convolution.
692        ///
693        /// If `W` is weights tensor to forward convolution, `R` is the result/returned tensor of forward convolution,
694        /// and `L` is the loss function, convolution2DWeightsGradientWithIncomingGradientTensor returns tensor `dL/dW = dL/dR * dR/dW`,
695        /// where `dL/dR` is the incomingGradient parameter.
696        ///
697        /// - Parameters:
698        /// - incomingGradient: Incoming loss gradient tensor
699        /// - weights: Forward pass weights tensor
700        /// - outputShape: Shape of the forward pass source tensor
701        /// - forwardConvolutionDescriptor: Forward convolution 2D op ``descriptor``
702        /// - name: The name for the operation.
703        /// - Returns: A valid MPSGraphTensor object
704        #[unsafe(method(convolution2DWeightsGradientWithIncomingGradientTensor:sourceTensor:outputShape:forwardConvolutionDescriptor:name:))]
705        #[unsafe(method_family = none)]
706        pub unsafe fn convolution2DWeightsGradientWithIncomingGradientTensor_sourceTensor_outputShape_forwardConvolutionDescriptor_name(
707            &self,
708            incoming_gradient: &MPSGraphTensor,
709            source: &MPSGraphTensor,
710            output_shape: &MPSShape,
711            forward_convolution_descriptor: &MPSGraphConvolution2DOpDescriptor,
712            name: Option<&NSString>,
713        ) -> Retained<MPSGraphTensor>;
714
715        #[cfg(feature = "MPSGraphTensor")]
716        /// Creates a 2D convolution gradient operation with respect to weights tensor of forward convolution.
717        ///
718        /// If `W` is weights tensor to forward convolution, `R` is the result/returned tensor of forward convolution,
719        /// and `L` is the loss function, convolution2DWeightsGradientWithIncomingGradientTensor returns tensor `dL/dW = dL/dR * dR/dW`,
720        /// where `dL/dR` is the incomingGradient parameter.
721        ///
722        /// - Parameters:
723        /// - incomingGradient: Incoming loss gradient tensor
724        /// - weights: Forward pass weights tensor
725        /// - outputShapeTensor: 4D int32 or Int64 Tensor. Shape of the forward pass source tensor
726        /// - forwardConvolutionDescriptor: Forward convolution 2D op ``descriptor``
727        /// - name: The name for the operation.
728        /// - Returns: A valid MPSGraphTensor object
729        #[unsafe(method(convolution2DWeightsGradientWithIncomingGradientTensor:sourceTensor:outputShapeTensor:forwardConvolutionDescriptor:name:))]
730        #[unsafe(method_family = none)]
731        pub unsafe fn convolution2DWeightsGradientWithIncomingGradientTensor_sourceTensor_outputShapeTensor_forwardConvolutionDescriptor_name(
732            &self,
733            gradient: &MPSGraphTensor,
734            source: &MPSGraphTensor,
735            output_shape_tensor: &MPSGraphTensor,
736            forward_convolution_descriptor: &MPSGraphConvolution2DOpDescriptor,
737            name: Option<&NSString>,
738        ) -> Retained<MPSGraphTensor>;
739
740        #[cfg(feature = "MPSGraphTensor")]
741        /// Creates a 3D forward convolution operation and returns the result tensor.
742        ///
743        /// - Parameters:
744        /// - source: source tensor - must be of rank 5. The layout is defined by ``descriptor.dataLayout``.
745        /// - weights: weights tensor, must be rank 5. The layout is defined by ``descriptor.weightsLayout``.
746        /// - descriptor: Specifies strides, dilation rates, paddings and layouts.
747        /// - name: The name for the operation.
748        /// - Returns: A valid MPSGraphTensor object
749        #[unsafe(method(convolution3DWithSourceTensor:weightsTensor:descriptor:name:))]
750        #[unsafe(method_family = none)]
751        pub unsafe fn convolution3DWithSourceTensor_weightsTensor_descriptor_name(
752            &self,
753            source: &MPSGraphTensor,
754            weights: &MPSGraphTensor,
755            descriptor: &MPSGraphConvolution3DOpDescriptor,
756            name: Option<&NSString>,
757        ) -> Retained<MPSGraphTensor>;
758
759        #[cfg(all(
760            feature = "MPSGraphTensor",
761            feature = "objc2-metal-performance-shaders"
762        ))]
763        /// Creates a 3D convolution gradient operation with respect to the source tensor of the forward convolution.
764        ///
765        /// If `S` is source tensor to forward convolution, `R` is the result/returned tensor of forward convolution,
766        /// and `L` is the loss function, convolution3DDataGradientWithIncomingGradientTensor returns tensor `dL/dS = dL/dR * dR/dS`,
767        /// where `dL/dR` is the incomingGradient parameter.
768        ///
769        /// - Parameters:
770        /// - incomingGradient: Incoming loss gradient tensor
771        /// - weights: Forward pass weights tensor
772        /// - outputShape: Shape of the forward pass source tensor
773        /// - forwardConvolutionDescriptor: Forward convolution 2D op ``descriptor``
774        /// - name: The name for the operation.
775        /// - Returns: A valid MPSGraphTensor object
776        #[unsafe(method(convolution3DDataGradientWithIncomingGradientTensor:weightsTensor:outputShape:forwardConvolutionDescriptor:name:))]
777        #[unsafe(method_family = none)]
778        pub unsafe fn convolution3DDataGradientWithIncomingGradientTensor_weightsTensor_outputShape_forwardConvolutionDescriptor_name(
779            &self,
780            incoming_gradient: &MPSGraphTensor,
781            weights: &MPSGraphTensor,
782            output_shape: &MPSShape,
783            forward_convolution_descriptor: &MPSGraphConvolution3DOpDescriptor,
784            name: Option<&NSString>,
785        ) -> Retained<MPSGraphTensor>;
786
787        #[cfg(feature = "MPSGraphTensor")]
788        /// Creates a 3D convolution gradient operation with respect to the source tensor of the forward convolution.
789        ///
790        /// If `S` is source tensor to forward convolution, `R` is the result/returned tensor of forward convolution,
791        /// and `L` is the loss function, convolution3DDataGradientWithIncomingGradientTensor returns tensor `dL/dS = dL/dR * dR/dS`,
792        /// where `dL/dR` is the incomingGradient parameter.
793        ///
794        /// - Parameters:
795        /// - incomingGradient: Incoming loss gradient tensor
796        /// - weights: Forward pass weights tensor
797        /// - outputShapeTensor: 4D Int32 or Int64 tensor. Shape of the forward pass source tensor
798        /// - forwardConvolutionDescriptor: Forward convolution 2D op ``descriptor``
799        /// - name: The name for the operation.
800        /// - Returns: A valid MPSGraphTensor object
801        #[unsafe(method(convolution3DDataGradientWithIncomingGradientTensor:weightsTensor:outputShapeTensor:forwardConvolutionDescriptor:name:))]
802        #[unsafe(method_family = none)]
803        pub unsafe fn convolution3DDataGradientWithIncomingGradientTensor_weightsTensor_outputShapeTensor_forwardConvolutionDescriptor_name(
804            &self,
805            gradient: &MPSGraphTensor,
806            weights: &MPSGraphTensor,
807            output_shape_tensor: &MPSGraphTensor,
808            forward_convolution_descriptor: &MPSGraphConvolution3DOpDescriptor,
809            name: Option<&NSString>,
810        ) -> Retained<MPSGraphTensor>;
811
812        #[cfg(all(
813            feature = "MPSGraphTensor",
814            feature = "objc2-metal-performance-shaders"
815        ))]
816        /// Creates a 3D convolution gradient operation with respect to the weights tensor of the forward convolution.
817        ///
818        /// If `W` is weights tensor to forward convolution, `R` is the result/returned tensor of forward convolution,
819        /// and `L` is the loss function, convolution3DWeightsGradientWithIncomingGradientTensor returns tensor `dL/dW = dL/dR * dR/dW`,
820        /// where `dL/dR` is the incomingGradient parameter.
821        ///
822        /// - Parameters:
823        /// - incomingGradient: Incoming loss gradient tensor
824        /// - weights: Forward pass weights tensor
825        /// - outputShape: Shape of the forward pass source tensor
826        /// - forwardConvolutionDescriptor: Forward convolution 2D op ``descriptor``
827        /// - name: The name for the operation.
828        /// - Returns: A valid MPSGraphTensor object
829        #[unsafe(method(convolution3DWeightsGradientWithIncomingGradientTensor:sourceTensor:outputShape:forwardConvolutionDescriptor:name:))]
830        #[unsafe(method_family = none)]
831        pub unsafe fn convolution3DWeightsGradientWithIncomingGradientTensor_sourceTensor_outputShape_forwardConvolutionDescriptor_name(
832            &self,
833            incoming_gradient: &MPSGraphTensor,
834            source: &MPSGraphTensor,
835            output_shape: &MPSShape,
836            forward_convolution_descriptor: &MPSGraphConvolution3DOpDescriptor,
837            name: Option<&NSString>,
838        ) -> Retained<MPSGraphTensor>;
839
840        #[cfg(feature = "MPSGraphTensor")]
841        /// Creates a 3D convolution gradient operation with respect to the weights tensor of the forward convolution.
842        ///
843        /// If `W` is weights tensor to forward convolution, `R` is the result/returned tensor of forward convolution,
844        /// and `L` is the loss function, convolution3DWeightsGradientWithIncomingGradientTensor returns tensor `dL/dW = dL/dR * dR/dW`,
845        /// where `dL/dR` is the incomingGradient parameter.
846        ///
847        /// - Parameters:
848        /// - incomingGradient: Incoming loss gradient tensor
849        /// - weights: Forward pass weights tensor
850        /// - outputShapeTensor: 4D int32 or Int64 Tensor. Shape of the forward pass source tensor
851        /// - forwardConvolutionDescriptor: Forward convolution 2D op ``descriptor``
852        /// - name: The name for the operation.
853        /// - Returns: A valid MPSGraphTensor object
854        #[unsafe(method(convolution3DWeightsGradientWithIncomingGradientTensor:sourceTensor:outputShapeTensor:forwardConvolutionDescriptor:name:))]
855        #[unsafe(method_family = none)]
856        pub unsafe fn convolution3DWeightsGradientWithIncomingGradientTensor_sourceTensor_outputShapeTensor_forwardConvolutionDescriptor_name(
857            &self,
858            gradient: &MPSGraphTensor,
859            source: &MPSGraphTensor,
860            output_shape_tensor: &MPSGraphTensor,
861            forward_convolution_descriptor: &MPSGraphConvolution3DOpDescriptor,
862            name: Option<&NSString>,
863        ) -> Retained<MPSGraphTensor>;
864    );
865}