objc2_metal_performance_shaders_graph/generated/
MPSGraphDepthwiseConvolutionOps.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 defines the parameters for  a 2D-depthwise convolution operation.
14    ///
15    /// An `MPSGraphDepthwiseConvolution2DOpDescriptor` defines constant parameters for 2D-depthwise convolutions.
16    /// Use this class with ``MPSGraph/depthwiseConvolution2DWithSourceTensor:weightsTensor:descriptor:name:``,
17    /// ``MPSGraph/depthwiseConvolution2DDataGradientWithIncomingGradientTensor:weightsTensor:outputShape:descriptor:name:``,
18    /// and ``MPSGraph/depthwiseConvolution2DWeightsGradientWithIncomingGradientTensor:sourceTensor:outputShape:descriptor:name:``
19    /// methods.
20    ///
21    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshadersgraph/mpsgraphdepthwiseconvolution2dopdescriptor?language=objc)
22    #[unsafe(super(MPSGraphObject, NSObject))]
23    #[derive(Debug, PartialEq, Eq, Hash)]
24    #[cfg(feature = "MPSGraphCore")]
25    pub struct MPSGraphDepthwiseConvolution2DOpDescriptor;
26);
27
28#[cfg(feature = "MPSGraphCore")]
29extern_conformance!(
30    unsafe impl NSCopying for MPSGraphDepthwiseConvolution2DOpDescriptor {}
31);
32
33#[cfg(feature = "MPSGraphCore")]
34unsafe impl CopyingHelper for MPSGraphDepthwiseConvolution2DOpDescriptor {
35    type Result = Self;
36}
37
38#[cfg(feature = "MPSGraphCore")]
39extern_conformance!(
40    unsafe impl NSObjectProtocol for MPSGraphDepthwiseConvolution2DOpDescriptor {}
41);
42
43#[cfg(feature = "MPSGraphCore")]
44impl MPSGraphDepthwiseConvolution2DOpDescriptor {
45    extern_methods!(
46        /// The stride for the x dimension.
47        ///
48        /// Default value: 1.
49        #[unsafe(method(strideInX))]
50        #[unsafe(method_family = none)]
51        pub unsafe fn strideInX(&self) -> NSUInteger;
52
53        /// Setter for [`strideInX`][Self::strideInX].
54        #[unsafe(method(setStrideInX:))]
55        #[unsafe(method_family = none)]
56        pub unsafe fn setStrideInX(&self, stride_in_x: NSUInteger);
57
58        /// The stride for the y dimension.
59        ///
60        /// Default value: 1.
61        #[unsafe(method(strideInY))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn strideInY(&self) -> NSUInteger;
64
65        /// Setter for [`strideInY`][Self::strideInY].
66        #[unsafe(method(setStrideInY:))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn setStrideInY(&self, stride_in_y: NSUInteger);
69
70        /// The dilation rate for the x dimension.
71        ///
72        /// Default value: 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 dilation rate for the y dimension.
83        ///
84        /// Default value: 1.
85        #[unsafe(method(dilationRateInY))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn dilationRateInY(&self) -> NSUInteger;
88
89        /// Setter for [`dilationRateInY`][Self::dilationRateInY].
90        #[unsafe(method(setDilationRateInY:))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn setDilationRateInY(&self, dilation_rate_in_y: NSUInteger);
93
94        /// The explicit padding value for the x dimension the operation adds before the data.
95        ///
96        /// Default value: 0.
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 explicit padding value for the x dimension operation adds after the data.
107        ///
108        /// Default value: 0.
109        #[unsafe(method(paddingRight))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn paddingRight(&self) -> NSUInteger;
112
113        /// Setter for [`paddingRight`][Self::paddingRight].
114        #[unsafe(method(setPaddingRight:))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn setPaddingRight(&self, padding_right: NSUInteger);
117
118        /// The explicit padding value for the y dimension operation adds before the data.
119        ///
120        /// Default value: 0.
121        #[unsafe(method(paddingTop))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn paddingTop(&self) -> NSUInteger;
124
125        /// Setter for [`paddingTop`][Self::paddingTop].
126        #[unsafe(method(setPaddingTop:))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn setPaddingTop(&self, padding_top: NSUInteger);
129
130        /// The explicit padding value for the y dimension operation adds after the data.
131        ///
132        /// Default value: 0.
133        #[unsafe(method(paddingBottom))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn paddingBottom(&self) -> NSUInteger;
136
137        /// Setter for [`paddingBottom`][Self::paddingBottom].
138        #[unsafe(method(setPaddingBottom:))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn setPaddingBottom(&self, padding_bottom: NSUInteger);
141
142        /// The padding style for the operation.
143        ///
144        /// Default value is `MPSGraphPaddingStyleExplicit`.
145        #[unsafe(method(paddingStyle))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn paddingStyle(&self) -> MPSGraphPaddingStyle;
148
149        /// Setter for [`paddingStyle`][Self::paddingStyle].
150        #[unsafe(method(setPaddingStyle:))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn setPaddingStyle(&self, padding_style: MPSGraphPaddingStyle);
153
154        /// The data layout of the input data in the forward pass.
155        ///
156        /// See: ``MPSGraphTensorNamedDataLayout``.
157        #[unsafe(method(dataLayout))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn dataLayout(&self) -> MPSGraphTensorNamedDataLayout;
160
161        /// Setter for [`dataLayout`][Self::dataLayout].
162        #[unsafe(method(setDataLayout:))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn setDataLayout(&self, data_layout: MPSGraphTensorNamedDataLayout);
165
166        /// The data layout of the weights.
167        ///
168        /// NOTE: 'O' index is channel multiplier index. See: ``MPSGraphTensorNamedDataLayout``.
169        #[unsafe(method(weightsLayout))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn weightsLayout(&self) -> MPSGraphTensorNamedDataLayout;
172
173        /// Setter for [`weightsLayout`][Self::weightsLayout].
174        #[unsafe(method(setWeightsLayout:))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn setWeightsLayout(&self, weights_layout: MPSGraphTensorNamedDataLayout);
177
178        /// Creates a 2D-depthwise convolution descriptor with given values.
179        ///
180        /// - Parameters:
181        /// - strideInX: See `strideInX` property.
182        /// - strideInY: See `strideInY` property.
183        /// - dilationRateInX: See `dilationRateInX` property.
184        /// - dilationRateInY: See `dilationRateInY` property.
185        /// - paddingLeft: See `paddingLeft` property.
186        /// - paddingRight: See `paddingRight` property.
187        /// - paddingTop: See `paddingTop` property.
188        /// - paddingBottom: See `paddingBottom` property.
189        /// - paddingStyle: See `paddingStyle` property.
190        /// - dataLayout: See `dataLayout` property.
191        /// - weightsLayout: See `weightsLayout` property.
192        /// - Returns: The descriptor on autoreleasepool.
193        #[unsafe(method(descriptorWithStrideInX:strideInY:dilationRateInX:dilationRateInY:paddingLeft:paddingRight:paddingTop:paddingBottom:paddingStyle:dataLayout:weightsLayout:))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn descriptorWithStrideInX_strideInY_dilationRateInX_dilationRateInY_paddingLeft_paddingRight_paddingTop_paddingBottom_paddingStyle_dataLayout_weightsLayout(
196            stride_in_x: NSUInteger,
197            stride_in_y: NSUInteger,
198            dilation_rate_in_x: NSUInteger,
199            dilation_rate_in_y: NSUInteger,
200            padding_left: NSUInteger,
201            padding_right: NSUInteger,
202            padding_top: NSUInteger,
203            padding_bottom: NSUInteger,
204            padding_style: MPSGraphPaddingStyle,
205            data_layout: MPSGraphTensorNamedDataLayout,
206            weights_layout: MPSGraphTensorNamedDataLayout,
207        ) -> Option<Retained<Self>>;
208
209        /// Creates a 2D-depthwise convolution descriptor with given properties and default values.
210        ///
211        /// - Parameters:
212        /// - dataLayout: See `dataLayout` property.
213        /// - weightsLayout: See `weightsLayout` property.
214        /// - Returns: The descriptor on autoreleasepool.
215        #[unsafe(method(descriptorWithDataLayout:weightsLayout:))]
216        #[unsafe(method_family = none)]
217        pub unsafe fn descriptorWithDataLayout_weightsLayout(
218            data_layout: MPSGraphTensorNamedDataLayout,
219            weights_layout: MPSGraphTensorNamedDataLayout,
220        ) -> Option<Retained<Self>>;
221
222        /// Sets the explicit padding values.
223        ///
224        /// Note: this method also sets `paddingStyle` to `MPSGraphPaddingStyleExplicit` (see ``MPSGraphPaddingStyle``).
225        ///
226        /// - Parameters:
227        /// - paddingLeft: See `paddingLeft` property.
228        /// - paddingRight: See `paddingRight` property.
229        /// - paddingTop: See `paddingTop` property.
230        /// - paddingBottom: See `paddingBottom` property.
231        #[unsafe(method(setExplicitPaddingWithPaddingLeft:paddingRight:paddingTop:paddingBottom:))]
232        #[unsafe(method_family = none)]
233        pub unsafe fn setExplicitPaddingWithPaddingLeft_paddingRight_paddingTop_paddingBottom(
234            &self,
235            padding_left: NSUInteger,
236            padding_right: NSUInteger,
237            padding_top: NSUInteger,
238            padding_bottom: NSUInteger,
239        );
240    );
241}
242
243/// Methods declared on superclass `NSObject`.
244#[cfg(feature = "MPSGraphCore")]
245impl MPSGraphDepthwiseConvolution2DOpDescriptor {
246    extern_methods!(
247        #[unsafe(method(init))]
248        #[unsafe(method_family = init)]
249        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
250
251        #[unsafe(method(new))]
252        #[unsafe(method_family = new)]
253        pub unsafe fn new() -> Retained<Self>;
254    );
255}
256
257extern_class!(
258    /// The class that defines the parameters for a 3D-depthwise convolution operation.
259    ///
260    /// A `MPSGraphDepthwiseConvolution3DOpDescriptor` defines constant parameters for 3D depthwise convolutions.
261    /// Use this class with ``MPSGraph/depthwiseConvolution3DWithSourceTensor:weightsTensor:descriptor:name:``,
262    /// ``MPSGraph/depthwiseConvolution3DDataGradientWithIncomingGradientTensor:weightsTensor:outputShape:descriptor:name:``
263    /// and ``MPSGraph/depthwiseConvolution3DWeightsGradientWithIncomingGradientTensor:sourceTensor:outputShape:descriptor:name:``
264    /// methods.
265    ///
266    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshadersgraph/mpsgraphdepthwiseconvolution3dopdescriptor?language=objc)
267    #[unsafe(super(MPSGraphObject, NSObject))]
268    #[derive(Debug, PartialEq, Eq, Hash)]
269    #[cfg(feature = "MPSGraphCore")]
270    pub struct MPSGraphDepthwiseConvolution3DOpDescriptor;
271);
272
273#[cfg(feature = "MPSGraphCore")]
274extern_conformance!(
275    unsafe impl NSCopying for MPSGraphDepthwiseConvolution3DOpDescriptor {}
276);
277
278#[cfg(feature = "MPSGraphCore")]
279unsafe impl CopyingHelper for MPSGraphDepthwiseConvolution3DOpDescriptor {
280    type Result = Self;
281}
282
283#[cfg(feature = "MPSGraphCore")]
284extern_conformance!(
285    unsafe impl NSObjectProtocol for MPSGraphDepthwiseConvolution3DOpDescriptor {}
286);
287
288#[cfg(feature = "MPSGraphCore")]
289impl MPSGraphDepthwiseConvolution3DOpDescriptor {
290    extern_methods!(
291        /// The strides for spatial dimensions.
292        ///
293        /// Must be three numbers, one for each spatial dimension, fastest running index last.
294        /// Default value: `
295        /// @
296        /// [
297        /// @
298        /// 1,
299        /// @
300        /// 1,
301        /// @
302        /// 1 ]`
303        #[unsafe(method(strides))]
304        #[unsafe(method_family = none)]
305        pub unsafe fn strides(&self) -> Retained<NSArray<NSNumber>>;
306
307        /// Setter for [`strides`][Self::strides].
308        ///
309        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
310        #[unsafe(method(setStrides:))]
311        #[unsafe(method_family = none)]
312        pub unsafe fn setStrides(&self, strides: &NSArray<NSNumber>);
313
314        /// The dilation rates for spatial dimensions.
315        ///
316        /// Must be three numbers, one for each spatial dimension, fastest running index last.
317        /// Default value: `
318        /// @
319        /// [
320        /// @
321        /// 1,
322        /// @
323        /// 1,
324        /// @
325        /// 1 ]`
326        #[unsafe(method(dilationRates))]
327        #[unsafe(method_family = none)]
328        pub unsafe fn dilationRates(&self) -> Retained<NSArray<NSNumber>>;
329
330        /// Setter for [`dilationRates`][Self::dilationRates].
331        ///
332        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
333        #[unsafe(method(setDilationRates:))]
334        #[unsafe(method_family = none)]
335        pub unsafe fn setDilationRates(&self, dilation_rates: &NSArray<NSNumber>);
336
337        /// The padding values for spatial dimensions.
338        ///
339        /// Must be six numbers, two for each spatial dimension.
340        /// For example `paddingValues[0]` defines the explicit padding
341        /// amount before the first spatial dimension (slowest running index of spatial dimensions),
342        /// `paddingValues[1]` defines the padding amount after the first spatial dimension etc.
343        /// Use only with `paddingStyle = MPSGraphPaddingStyleExplicit`.
344        /// Default value: `
345        /// @
346        /// [
347        /// @
348        /// 0,
349        /// @
350        /// 0,
351        /// @
352        /// 0,
353        /// @
354        /// 0,
355        /// @
356        /// 0,
357        /// @
358        /// 0 ]`
359        #[unsafe(method(paddingValues))]
360        #[unsafe(method_family = none)]
361        pub unsafe fn paddingValues(&self) -> Retained<NSArray<NSNumber>>;
362
363        /// Setter for [`paddingValues`][Self::paddingValues].
364        ///
365        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
366        #[unsafe(method(setPaddingValues:))]
367        #[unsafe(method_family = none)]
368        pub unsafe fn setPaddingValues(&self, padding_values: &NSArray<NSNumber>);
369
370        /// The padding style for the operation.
371        ///
372        /// Default value: `MPSGraphPaddingStyleExplicit`.
373        #[unsafe(method(paddingStyle))]
374        #[unsafe(method_family = none)]
375        pub unsafe fn paddingStyle(&self) -> MPSGraphPaddingStyle;
376
377        /// Setter for [`paddingStyle`][Self::paddingStyle].
378        #[unsafe(method(setPaddingStyle:))]
379        #[unsafe(method_family = none)]
380        pub unsafe fn setPaddingStyle(&self, padding_style: MPSGraphPaddingStyle);
381
382        /// The axis that contains the channels in the input and the weights, within
383        /// the 4D tile of the last dimensions.
384        ///
385        /// For example the value of `-1` corresponds to `NDHWC`, `NHWC` layouts. This allows the placement
386        /// of the channel index anywhere within the last 4 dimensions of the tensor. In case your
387        /// weights are in a different layout you can bring them to the same layout
388        /// as inputs using transposes or permutations.
389        /// Default value: `-4`, corresponds to `NCDHW` and `CDHW` layouts.
390        #[unsafe(method(channelDimensionIndex))]
391        #[unsafe(method_family = none)]
392        pub unsafe fn channelDimensionIndex(&self) -> NSInteger;
393
394        /// Setter for [`channelDimensionIndex`][Self::channelDimensionIndex].
395        #[unsafe(method(setChannelDimensionIndex:))]
396        #[unsafe(method_family = none)]
397        pub unsafe fn setChannelDimensionIndex(&self, channel_dimension_index: NSInteger);
398
399        /// Creates a 3D depthwise convolution descriptor with given values.
400        ///
401        /// - Parameters:
402        /// - strides: See `strides` property.
403        /// - dilationRates: See `dilationRates` property.
404        /// - paddingValues: See `paddingValues` property.
405        /// - paddingStyle: See `paddingStyle` property.
406        /// - Returns: The descriptor on autoreleasepool.
407        #[unsafe(method(descriptorWithStrides:dilationRates:paddingValues:paddingStyle:))]
408        #[unsafe(method_family = none)]
409        pub unsafe fn descriptorWithStrides_dilationRates_paddingValues_paddingStyle(
410            strides: &NSArray<NSNumber>,
411            dilation_rates: &NSArray<NSNumber>,
412            padding_values: &NSArray<NSNumber>,
413            padding_style: MPSGraphPaddingStyle,
414        ) -> Option<Retained<Self>>;
415
416        /// Creates a 3D depthwise convolution descriptor with default values.
417        ///
418        /// - Parameters:
419        /// - paddingStyle: See `paddingStyle` property.
420        /// - Returns: The descriptor on autoreleasepool.
421        #[unsafe(method(descriptorWithPaddingStyle:))]
422        #[unsafe(method_family = none)]
423        pub unsafe fn descriptorWithPaddingStyle(
424            padding_style: MPSGraphPaddingStyle,
425        ) -> Option<Retained<Self>>;
426    );
427}
428
429/// Methods declared on superclass `NSObject`.
430#[cfg(feature = "MPSGraphCore")]
431impl MPSGraphDepthwiseConvolution3DOpDescriptor {
432    extern_methods!(
433        #[unsafe(method(init))]
434        #[unsafe(method_family = init)]
435        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
436
437        #[unsafe(method(new))]
438        #[unsafe(method_family = new)]
439        pub unsafe fn new() -> Retained<Self>;
440    );
441}
442
443/// MPSGraphDepthwiseConvolutionOps.
444#[cfg(all(feature = "MPSGraph", feature = "MPSGraphCore"))]
445impl MPSGraph {
446    extern_methods!(
447        #[cfg(feature = "MPSGraphTensor")]
448        /// Creates a 2D-depthwise convolution operation and returns the result tensor.
449        ///
450        /// - Parameters:
451        /// - source: A 2D Image source as tensor - must be of rank=4. The layout is defined by `descriptor.dataLayout`.
452        /// - weights: The weights tensor, must be rank=4. The layout is defined by `descriptor.weightsLayout`.
453        /// - descriptor: The descriptor object that specifies strides, dilation rates, paddings and layouts.
454        /// - name: The name for the operation.
455        /// - Returns: A valid MPSGraphTensor object
456        #[unsafe(method(depthwiseConvolution2DWithSourceTensor:weightsTensor:descriptor:name:))]
457        #[unsafe(method_family = none)]
458        pub unsafe fn depthwiseConvolution2DWithSourceTensor_weightsTensor_descriptor_name(
459            &self,
460            source: &MPSGraphTensor,
461            weights: &MPSGraphTensor,
462            descriptor: &MPSGraphDepthwiseConvolution2DOpDescriptor,
463            name: Option<&NSString>,
464        ) -> Retained<MPSGraphTensor>;
465
466        #[cfg(all(
467            feature = "MPSGraphTensor",
468            feature = "objc2-metal-performance-shaders"
469        ))]
470        /// Creates a 2D-depthwise convolution gradient for data operation and returns the result tensor.
471        ///
472        /// - Parameters:
473        /// - incomingGradient: A 2D input gradient tensor - must be of rank=4. The layout is defined by `descriptor.dataLayout`.
474        /// - weights: The weights tensor, must be rank=4. The layout is defined by `descriptor.weightsLayout`.
475        /// - outputShape: The shape of the οutput tensor (and therefore input tensor of forward pass).
476        /// - descriptor: The descriptor object that specifies strides, dilation rates, paddings and layouts.
477        /// - name: The name for the operation.
478        /// - Returns: A valid MPSGraphTensor object
479        #[unsafe(method(depthwiseConvolution2DDataGradientWithIncomingGradientTensor:weightsTensor:outputShape:descriptor:name:))]
480        #[unsafe(method_family = none)]
481        pub unsafe fn depthwiseConvolution2DDataGradientWithIncomingGradientTensor_weightsTensor_outputShape_descriptor_name(
482            &self,
483            incoming_gradient: &MPSGraphTensor,
484            weights: &MPSGraphTensor,
485            output_shape: &MPSShape,
486            descriptor: &MPSGraphDepthwiseConvolution2DOpDescriptor,
487            name: Option<&NSString>,
488        ) -> Retained<MPSGraphTensor>;
489
490        #[cfg(all(
491            feature = "MPSGraphTensor",
492            feature = "objc2-metal-performance-shaders"
493        ))]
494        /// Creates a 2D-depthwise convolution gradient for weights operation and returns the result tensor.
495        ///
496        /// - Parameters:
497        /// - incomingGradient: A 2D input gradient tensor - must be of rank=4. The layout is defined by `descriptor.dataLayout`.
498        /// - source: A 2D Image source as tensor - must be of rank=4. The layout is defined by `descriptor.dataLayout`.
499        /// - outputShape: The shape of the οutput tensor (and therefore weight tensor of forward pass).
500        /// - descriptor: The descriptor object that specifies strides, dilation rates, paddings and layouts.
501        /// - name: The name for the operation.
502        /// - Returns: A valid MPSGraphTensor object
503        #[unsafe(method(depthwiseConvolution2DWeightsGradientWithIncomingGradientTensor:sourceTensor:outputShape:descriptor:name:))]
504        #[unsafe(method_family = none)]
505        pub unsafe fn depthwiseConvolution2DWeightsGradientWithIncomingGradientTensor_sourceTensor_outputShape_descriptor_name(
506            &self,
507            incoming_gradient: &MPSGraphTensor,
508            source: &MPSGraphTensor,
509            output_shape: &MPSShape,
510            descriptor: &MPSGraphDepthwiseConvolution2DOpDescriptor,
511            name: Option<&NSString>,
512        ) -> Retained<MPSGraphTensor>;
513
514        #[cfg(feature = "MPSGraphTensor")]
515        /// Creates a 3D depthwise convolution operation and returns the result tensor.
516        ///
517        /// Works exactly like depthwise convolution2D, but in three dimensions. Supports different layouts with
518        /// the ``MPSGraphDepthwiseConvolution3DOpDescriptor/channelDimensionIndex`` property.
519        /// If your weights need a different layout add a permute operation on them before this operation.
520        ///
521        /// - Parameters:
522        /// - source: A 3D Image source as tensor - must be at least rank=4 (CDHW when channelDimensionIndex = -4).
523        /// - weights: The weights tensor, must be rank=4 - axes are interpreted as CDHW when channelDimensionIndex = -4 .
524        /// - descriptor: The descriptor object that specifies strides, dilation rates and paddings.
525        /// - name: The name for the operation.
526        /// - Returns: A valid MPSGraphTensor object
527        #[unsafe(method(depthwiseConvolution3DWithSourceTensor:weightsTensor:descriptor:name:))]
528        #[unsafe(method_family = none)]
529        pub unsafe fn depthwiseConvolution3DWithSourceTensor_weightsTensor_descriptor_name(
530            &self,
531            source: &MPSGraphTensor,
532            weights: &MPSGraphTensor,
533            descriptor: &MPSGraphDepthwiseConvolution3DOpDescriptor,
534            name: Option<&NSString>,
535        ) -> Retained<MPSGraphTensor>;
536
537        #[cfg(all(
538            feature = "MPSGraphTensor",
539            feature = "objc2-metal-performance-shaders"
540        ))]
541        /// Creates a 3D depthwise convolution gradient for data operation and returns the result tensor.
542        ///
543        /// - Parameters:
544        /// - incomingGradient: A 3D input gradient tensor - must be at least rank=4 (CDHW).
545        /// - weights: The weights tensor, must be rank=4 - axes are interpreted as CDHW.
546        /// - outputShape: The shape of the οutput tensor (and therefore input tensor of forward pass).
547        /// - descriptor: The descriptor object that  specifies strides, dilation rates and paddings.
548        /// - name: The name for the operation.
549        /// - Returns: A valid MPSGraphTensor object
550        #[unsafe(method(depthwiseConvolution3DDataGradientWithIncomingGradientTensor:weightsTensor:outputShape:descriptor:name:))]
551        #[unsafe(method_family = none)]
552        pub unsafe fn depthwiseConvolution3DDataGradientWithIncomingGradientTensor_weightsTensor_outputShape_descriptor_name(
553            &self,
554            incoming_gradient: &MPSGraphTensor,
555            weights: &MPSGraphTensor,
556            output_shape: Option<&MPSShape>,
557            descriptor: &MPSGraphDepthwiseConvolution3DOpDescriptor,
558            name: Option<&NSString>,
559        ) -> Retained<MPSGraphTensor>;
560
561        #[cfg(all(
562            feature = "MPSGraphTensor",
563            feature = "objc2-metal-performance-shaders"
564        ))]
565        /// Creates a 3D depthwise convolution gradient for weights operation and returns the result tensor.
566        ///
567        /// - Parameters:
568        /// - incomingGradient: A 3D input gradient tensor - must be at least rank=4 (NCDHW).
569        /// - source: The forward pass 3D Image source as tensor - must be at least rank=4 (NCDHW).
570        /// - outputShape: The shape of the οutput tensor (and therefore weight tensor of forward pass).
571        /// - descriptor: The descriptor object that specifies strides, dilation rates and paddings.
572        /// - name: The name for the operation.
573        /// - Returns: A valid MPSGraphTensor object
574        #[unsafe(method(depthwiseConvolution3DWeightsGradientWithIncomingGradientTensor:sourceTensor:outputShape:descriptor:name:))]
575        #[unsafe(method_family = none)]
576        pub unsafe fn depthwiseConvolution3DWeightsGradientWithIncomingGradientTensor_sourceTensor_outputShape_descriptor_name(
577            &self,
578            incoming_gradient: &MPSGraphTensor,
579            source: &MPSGraphTensor,
580            output_shape: &MPSShape,
581            descriptor: &MPSGraphDepthwiseConvolution3DOpDescriptor,
582            name: Option<&NSString>,
583        ) -> Retained<MPSGraphTensor>;
584    );
585}