objc2_metal_performance_shaders_graph/generated/MPSGraphPoolingOps.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
12/// The flattening mode for returned indices with max-pooling.
13///
14/// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshadersgraph/mpsgraphpoolingreturnindicesmode?language=objc)
15// NS_ENUM
16#[repr(transparent)]
17#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
18pub struct MPSGraphPoolingReturnIndicesMode(pub NSUInteger);
19impl MPSGraphPoolingReturnIndicesMode {
20 /// No indices returned.
21 #[doc(alias = "MPSGraphPoolingReturnIndicesNone")]
22 pub const None: Self = Self(0);
23 /// Returns indices flattened in inner most (last) dimension.
24 #[doc(alias = "MPSGraphPoolingReturnIndicesGlobalFlatten1D")]
25 pub const GlobalFlatten1D: Self = Self(1);
26 /// Returns indices flattened in 2 innermost dimensions. eg: HW in NCHW.
27 #[doc(alias = "MPSGraphPoolingReturnIndicesGlobalFlatten2D")]
28 pub const GlobalFlatten2D: Self = Self(2);
29 /// Returns indices flattened in 3 innernost dimensions. eg: HWC in NHWC.
30 #[doc(alias = "MPSGraphPoolingReturnIndicesGlobalFlatten3D")]
31 pub const GlobalFlatten3D: Self = Self(3);
32 /// Returns indices flattened in 4 innermost dimensions.
33 #[doc(alias = "MPSGraphPoolingReturnIndicesGlobalFlatten4D")]
34 pub const GlobalFlatten4D: Self = Self(4);
35 /// Returns indices within pooling window, flattened in inner most dimension.
36 #[doc(alias = "MPSGraphPoolingReturnIndicesLocalFlatten1D")]
37 pub const LocalFlatten1D: Self = Self(5);
38 /// Returns indices within pooling window, flattened in 2 innermost dimensions. eg: HW in NCHW.
39 #[doc(alias = "MPSGraphPoolingReturnIndicesLocalFlatten2D")]
40 pub const LocalFlatten2D: Self = Self(6);
41 /// Returns indices within pooling window, flattened in 3 innernost dimensions. eg: HWC in NHWC.
42 #[doc(alias = "MPSGraphPoolingReturnIndicesLocalFlatten3D")]
43 pub const LocalFlatten3D: Self = Self(7);
44 /// Returns indices within pooling window, flattened in 4 innermost dimensions.
45 #[doc(alias = "MPSGraphPoolingReturnIndicesLocalFlatten4D")]
46 pub const LocalFlatten4D: Self = Self(8);
47}
48
49unsafe impl Encode for MPSGraphPoolingReturnIndicesMode {
50 const ENCODING: Encoding = NSUInteger::ENCODING;
51}
52
53unsafe impl RefEncode for MPSGraphPoolingReturnIndicesMode {
54 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
55}
56
57extern_class!(
58 /// The class that defines the parameters for a 2D pooling operation.
59 ///
60 /// Use this descriptor with the following methods:
61 /// - ``MPSGraph/maxPooling2DWithSourceTensor:descriptor:name:``
62 /// - ``MPSGraph/maxPooling2DReturnIndicesWithSourceTensor:descriptor:name:``
63 /// - ``MPSGraph/maxPooling2DGradientWithGradientTensor:sourceTensor:descriptor:name:``
64 /// - ``MPSGraph/maxPooling2DGradientWithGradientTensor:indicesTensor:outputShape:descriptor:name:``
65 /// - ``MPSGraph/maxPooling2DGradientWithGradientTensor:indicesTensor:outputShapeTensor:descriptor:name:``
66 /// - ``MPSGraph/avgPooling2DWithSourceTensor:descriptor:name:``
67 /// - ``MPSGraph/avgPooling2DGradientWithGradientTensor:sourceTensor:descriptor:name:``
68 ///
69 /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshadersgraph/mpsgraphpooling2dopdescriptor?language=objc)
70 #[unsafe(super(MPSGraphObject, NSObject))]
71 #[derive(Debug, PartialEq, Eq, Hash)]
72 #[cfg(feature = "MPSGraphCore")]
73 pub struct MPSGraphPooling2DOpDescriptor;
74);
75
76#[cfg(feature = "MPSGraphCore")]
77extern_conformance!(
78 unsafe impl NSCopying for MPSGraphPooling2DOpDescriptor {}
79);
80
81#[cfg(feature = "MPSGraphCore")]
82unsafe impl CopyingHelper for MPSGraphPooling2DOpDescriptor {
83 type Result = Self;
84}
85
86#[cfg(feature = "MPSGraphCore")]
87extern_conformance!(
88 unsafe impl NSObjectProtocol for MPSGraphPooling2DOpDescriptor {}
89);
90
91#[cfg(feature = "MPSGraphCore")]
92impl MPSGraphPooling2DOpDescriptor {
93 extern_methods!(
94 /// Defines the pooling window size for the width dimension.
95 #[unsafe(method(kernelWidth))]
96 #[unsafe(method_family = none)]
97 pub unsafe fn kernelWidth(&self) -> NSUInteger;
98
99 /// Setter for [`kernelWidth`][Self::kernelWidth].
100 #[unsafe(method(setKernelWidth:))]
101 #[unsafe(method_family = none)]
102 pub unsafe fn setKernelWidth(&self, kernel_width: NSUInteger);
103
104 /// Defines the pooling window size for the height dimension.
105 #[unsafe(method(kernelHeight))]
106 #[unsafe(method_family = none)]
107 pub unsafe fn kernelHeight(&self) -> NSUInteger;
108
109 /// Setter for [`kernelHeight`][Self::kernelHeight].
110 #[unsafe(method(setKernelHeight:))]
111 #[unsafe(method_family = none)]
112 pub unsafe fn setKernelHeight(&self, kernel_height: NSUInteger);
113
114 /// Defines the stride for the width dimension.
115 ///
116 /// Default value: 1.
117 #[unsafe(method(strideInX))]
118 #[unsafe(method_family = none)]
119 pub unsafe fn strideInX(&self) -> NSUInteger;
120
121 /// Setter for [`strideInX`][Self::strideInX].
122 #[unsafe(method(setStrideInX:))]
123 #[unsafe(method_family = none)]
124 pub unsafe fn setStrideInX(&self, stride_in_x: NSUInteger);
125
126 /// Defines the stride for the height dimension.
127 ///
128 /// Default value: 1.
129 #[unsafe(method(strideInY))]
130 #[unsafe(method_family = none)]
131 pub unsafe fn strideInY(&self) -> NSUInteger;
132
133 /// Setter for [`strideInY`][Self::strideInY].
134 #[unsafe(method(setStrideInY:))]
135 #[unsafe(method_family = none)]
136 pub unsafe fn setStrideInY(&self, stride_in_y: NSUInteger);
137
138 /// Defines the dilation rate for the width dimension.
139 ///
140 /// Default value: 1.
141 #[unsafe(method(dilationRateInX))]
142 #[unsafe(method_family = none)]
143 pub unsafe fn dilationRateInX(&self) -> NSUInteger;
144
145 /// Setter for [`dilationRateInX`][Self::dilationRateInX].
146 #[unsafe(method(setDilationRateInX:))]
147 #[unsafe(method_family = none)]
148 pub unsafe fn setDilationRateInX(&self, dilation_rate_in_x: NSUInteger);
149
150 /// Defines the dilation rate for the height dimension.
151 ///
152 /// Default value: 1.
153 #[unsafe(method(dilationRateInY))]
154 #[unsafe(method_family = none)]
155 pub unsafe fn dilationRateInY(&self) -> NSUInteger;
156
157 /// Setter for [`dilationRateInY`][Self::dilationRateInY].
158 #[unsafe(method(setDilationRateInY:))]
159 #[unsafe(method_family = none)]
160 pub unsafe fn setDilationRateInY(&self, dilation_rate_in_y: NSUInteger);
161
162 /// Defines the explicit padding value for the width dimension to add before the data.
163 ///
164 /// Default value: 0.
165 #[unsafe(method(paddingLeft))]
166 #[unsafe(method_family = none)]
167 pub unsafe fn paddingLeft(&self) -> NSUInteger;
168
169 /// Setter for [`paddingLeft`][Self::paddingLeft].
170 #[unsafe(method(setPaddingLeft:))]
171 #[unsafe(method_family = none)]
172 pub unsafe fn setPaddingLeft(&self, padding_left: NSUInteger);
173
174 /// Defines the explicit padding value for the width dimension to add after the data.
175 ///
176 /// Default value: 0.
177 #[unsafe(method(paddingRight))]
178 #[unsafe(method_family = none)]
179 pub unsafe fn paddingRight(&self) -> NSUInteger;
180
181 /// Setter for [`paddingRight`][Self::paddingRight].
182 #[unsafe(method(setPaddingRight:))]
183 #[unsafe(method_family = none)]
184 pub unsafe fn setPaddingRight(&self, padding_right: NSUInteger);
185
186 /// Defines the explicit padding value for the height dimension to add before the data.
187 ///
188 /// Default value: 0.
189 #[unsafe(method(paddingTop))]
190 #[unsafe(method_family = none)]
191 pub unsafe fn paddingTop(&self) -> NSUInteger;
192
193 /// Setter for [`paddingTop`][Self::paddingTop].
194 #[unsafe(method(setPaddingTop:))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn setPaddingTop(&self, padding_top: NSUInteger);
197
198 /// Defines the explicit padding value for the height dimension to add after the data.
199 ///
200 /// Default value: 0.
201 #[unsafe(method(paddingBottom))]
202 #[unsafe(method_family = none)]
203 pub unsafe fn paddingBottom(&self) -> NSUInteger;
204
205 /// Setter for [`paddingBottom`][Self::paddingBottom].
206 #[unsafe(method(setPaddingBottom:))]
207 #[unsafe(method_family = none)]
208 pub unsafe fn setPaddingBottom(&self, padding_bottom: NSUInteger);
209
210 /// Defines what kind of padding graph applies to the operation.
211 ///
212 /// Default value: `MPSGraphPaddingStyleExplicit`.
213 #[unsafe(method(paddingStyle))]
214 #[unsafe(method_family = none)]
215 pub unsafe fn paddingStyle(&self) -> MPSGraphPaddingStyle;
216
217 /// Setter for [`paddingStyle`][Self::paddingStyle].
218 #[unsafe(method(setPaddingStyle:))]
219 #[unsafe(method_family = none)]
220 pub unsafe fn setPaddingStyle(&self, padding_style: MPSGraphPaddingStyle);
221
222 /// Defines the data layout of the input data in the forward pass. See: ``MPSGraphTensorNamedDataLayout``.
223 #[unsafe(method(dataLayout))]
224 #[unsafe(method_family = none)]
225 pub unsafe fn dataLayout(&self) -> MPSGraphTensorNamedDataLayout;
226
227 /// Setter for [`dataLayout`][Self::dataLayout].
228 #[unsafe(method(setDataLayout:))]
229 #[unsafe(method_family = none)]
230 pub unsafe fn setDataLayout(&self, data_layout: MPSGraphTensorNamedDataLayout);
231
232 /// Defines the mode for returned indices of maximum values within each pooling window.
233 /// Use this in conjunction with ``MPSGraph/maxPooling2DReturnIndicesWithSourceTensor:descriptor:name:`` API.
234 /// If `returnIndicesMode = MPSGraphPoolingReturnIndicesNone` then only the first result
235 /// MPSGraph returns from ``MPSGraph/maxPooling2DReturnIndicesWithSourceTensor:descriptor:name:``
236 /// will be valid and using the second result will assert.
237 /// Default value: `MPSGraphPoolingReturnIndicesNone`.
238 #[unsafe(method(returnIndicesMode))]
239 #[unsafe(method_family = none)]
240 pub unsafe fn returnIndicesMode(&self) -> MPSGraphPoolingReturnIndicesMode;
241
242 /// Setter for [`returnIndicesMode`][Self::returnIndicesMode].
243 #[unsafe(method(setReturnIndicesMode:))]
244 #[unsafe(method_family = none)]
245 pub unsafe fn setReturnIndicesMode(
246 &self,
247 return_indices_mode: MPSGraphPoolingReturnIndicesMode,
248 );
249
250 #[cfg(feature = "objc2-metal-performance-shaders")]
251 /// Defines the data type for returned indices.
252 /// Use this in conjunction with ``MPSGraph/maxPooling2DReturnIndicesWithSourceTensor:descriptor:name:`` API.
253 /// Currently MPSGraph supports the following datatypes: `MPSDataTypeInt32`.
254 /// Default value: `MPSDataTypeInt32`.
255 #[unsafe(method(returnIndicesDataType))]
256 #[unsafe(method_family = none)]
257 pub unsafe fn returnIndicesDataType(&self) -> MPSDataType;
258
259 #[cfg(feature = "objc2-metal-performance-shaders")]
260 /// Setter for [`returnIndicesDataType`][Self::returnIndicesDataType].
261 #[unsafe(method(setReturnIndicesDataType:))]
262 #[unsafe(method_family = none)]
263 pub unsafe fn setReturnIndicesDataType(&self, return_indices_data_type: MPSDataType);
264
265 /// Affects how the graph computes the output size.
266 ///
267 /// if set to `YES` then output size is computed by rounding up instead of down when dividing input size by stride.
268 /// Default value: `NO`.
269 #[unsafe(method(ceilMode))]
270 #[unsafe(method_family = none)]
271 pub unsafe fn ceilMode(&self) -> bool;
272
273 /// Setter for [`ceilMode`][Self::ceilMode].
274 #[unsafe(method(setCeilMode:))]
275 #[unsafe(method_family = none)]
276 pub unsafe fn setCeilMode(&self, ceil_mode: bool);
277
278 /// Defines a mode for average pooling, where samples outside the input tensor count as zeroes in the average computation.
279 ///
280 /// Otherwise the result is sum over samples divided by number of samples that didn't come from padding.
281 /// Default value: `NO`.
282 #[unsafe(method(includeZeroPadToAverage))]
283 #[unsafe(method_family = none)]
284 pub unsafe fn includeZeroPadToAverage(&self) -> bool;
285
286 /// Setter for [`includeZeroPadToAverage`][Self::includeZeroPadToAverage].
287 #[unsafe(method(setIncludeZeroPadToAverage:))]
288 #[unsafe(method_family = none)]
289 pub unsafe fn setIncludeZeroPadToAverage(&self, include_zero_pad_to_average: bool);
290
291 /// Creates a 2D pooling descriptor with given values.
292 ///
293 /// - Parameters:
294 /// - kernelWidth: See `kernelWidth` property.
295 /// - kernelHeight: See `kernelHeight` property.
296 /// - strideInX: See `strideInX` property.
297 /// - strideInY: See `strideInY` property.
298 /// - dilationRateInX: See `dilationRateInX` property.
299 /// - dilationRateInY: See `dilationRateInY` property.
300 /// - paddingLeft: See `paddingLeft` property.
301 /// - paddingRight: See `paddingRight` property.
302 /// - paddingTop: See `paddingTop` property.
303 /// - paddingBottom: See `paddingBottom` property.
304 /// - paddingStyle: See `paddingStyle` property.
305 /// - dataLayout: See `dataLayout` property.
306 /// - Returns: The descriptor on autoreleasepool.
307 #[unsafe(method(descriptorWithKernelWidth:kernelHeight:strideInX:strideInY:dilationRateInX:dilationRateInY:paddingLeft:paddingRight:paddingTop:paddingBottom:paddingStyle:dataLayout:))]
308 #[unsafe(method_family = none)]
309 pub unsafe fn descriptorWithKernelWidth_kernelHeight_strideInX_strideInY_dilationRateInX_dilationRateInY_paddingLeft_paddingRight_paddingTop_paddingBottom_paddingStyle_dataLayout(
310 kernel_width: NSUInteger,
311 kernel_height: NSUInteger,
312 stride_in_x: NSUInteger,
313 stride_in_y: NSUInteger,
314 dilation_rate_in_x: NSUInteger,
315 dilation_rate_in_y: NSUInteger,
316 padding_left: NSUInteger,
317 padding_right: NSUInteger,
318 padding_top: NSUInteger,
319 padding_bottom: NSUInteger,
320 padding_style: MPSGraphPaddingStyle,
321 data_layout: MPSGraphTensorNamedDataLayout,
322 ) -> Option<Retained<Self>>;
323
324 /// Creates a 2D pooling descriptor with given values.
325 ///
326 /// - Parameters:
327 /// - kernelWidth: See `kernelWidth` property.
328 /// - kernelHeight: See `kernelHeight`` property.
329 /// - strideInX: See `strideInX` property.
330 /// - strideInY: See `strideInY` property.
331 /// - paddingStyle: See `paddingStyle` property.
332 /// - dataLayout: See `dataLayout` property.
333 /// - Returns: The descriptor on autoreleasepool.
334 #[unsafe(method(descriptorWithKernelWidth:kernelHeight:strideInX:strideInY:paddingStyle:dataLayout:))]
335 #[unsafe(method_family = none)]
336 pub unsafe fn descriptorWithKernelWidth_kernelHeight_strideInX_strideInY_paddingStyle_dataLayout(
337 kernel_width: NSUInteger,
338 kernel_height: NSUInteger,
339 stride_in_x: NSUInteger,
340 stride_in_y: NSUInteger,
341 padding_style: MPSGraphPaddingStyle,
342 data_layout: MPSGraphTensorNamedDataLayout,
343 ) -> Option<Retained<Self>>;
344
345 /// Sets the explicit padding values and sets padding style to explicit.
346 ///
347 /// - Parameters:
348 /// - paddingLeft: See `paddingLeft` property.
349 /// - paddingRight: See `paddingRight` property.
350 /// - paddingTop: See `paddingTop` property.
351 /// - paddingBottom: See `paddingBottom` property.
352 #[unsafe(method(setExplicitPaddingWithPaddingLeft:paddingRight:paddingTop:paddingBottom:))]
353 #[unsafe(method_family = none)]
354 pub unsafe fn setExplicitPaddingWithPaddingLeft_paddingRight_paddingTop_paddingBottom(
355 &self,
356 padding_left: NSUInteger,
357 padding_right: NSUInteger,
358 padding_top: NSUInteger,
359 padding_bottom: NSUInteger,
360 );
361 );
362}
363
364/// Methods declared on superclass `NSObject`.
365#[cfg(feature = "MPSGraphCore")]
366impl MPSGraphPooling2DOpDescriptor {
367 extern_methods!(
368 #[unsafe(method(init))]
369 #[unsafe(method_family = init)]
370 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
371
372 #[unsafe(method(new))]
373 #[unsafe(method_family = new)]
374 pub unsafe fn new() -> Retained<Self>;
375 );
376}
377
378extern_class!(
379 /// The class that defines the parameters for a 4D pooling operation.
380 ///
381 /// Use this descriptor with the following methods:
382 /// - ``MPSGraph/maxPooling4DWithSourceTensor:descriptor:name:``
383 /// - ``MPSGraph/maxPooling4DReturnIndicesWithSourceTensor:descriptor:name:``
384 /// - ``MPSGraph/maxPooling4DGradientWithGradientTensor:sourceTensor:descriptor:name:``
385 /// - ``MPSGraph/maxPooling4DGradientWithGradientTensor:indicesTensor:outputShape:descriptor:name:``
386 /// - ``MPSGraph/maxPooling4DGradientWithGradientTensor:indicesTensor:outputShapeTensor:descriptor:name:``
387 /// - ``MPSGraph/avgPooling4DWithSourceTensor:descriptor:name:``
388 /// - ``MPSGraph/avgPooling4DGradientWithGradientTensor:sourceTensor:descriptor:name:``
389 /// - ``MPSGraph/L2NormPooling4DWithSourceTensor:descriptor:name:``
390 /// - ``MPSGraph/L2NormPooling4DGradientWithGradientTensor:sourceTensor:descriptor:name:``
391 ///
392 /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshadersgraph/mpsgraphpooling4dopdescriptor?language=objc)
393 #[unsafe(super(MPSGraphObject, NSObject))]
394 #[derive(Debug, PartialEq, Eq, Hash)]
395 #[cfg(feature = "MPSGraphCore")]
396 pub struct MPSGraphPooling4DOpDescriptor;
397);
398
399#[cfg(feature = "MPSGraphCore")]
400extern_conformance!(
401 unsafe impl NSCopying for MPSGraphPooling4DOpDescriptor {}
402);
403
404#[cfg(feature = "MPSGraphCore")]
405unsafe impl CopyingHelper for MPSGraphPooling4DOpDescriptor {
406 type Result = Self;
407}
408
409#[cfg(feature = "MPSGraphCore")]
410extern_conformance!(
411 unsafe impl NSObjectProtocol for MPSGraphPooling4DOpDescriptor {}
412);
413
414#[cfg(feature = "MPSGraphCore")]
415impl MPSGraphPooling4DOpDescriptor {
416 extern_methods!(
417 /// Defines the pooling window size.
418 ///
419 /// Must be four numbers, one for each spatial dimension, fastest running index last.
420 #[unsafe(method(kernelSizes))]
421 #[unsafe(method_family = none)]
422 pub unsafe fn kernelSizes(&self) -> Retained<NSArray<NSNumber>>;
423
424 /// Setter for [`kernelSizes`][Self::kernelSizes].
425 ///
426 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
427 #[unsafe(method(setKernelSizes:))]
428 #[unsafe(method_family = none)]
429 pub unsafe fn setKernelSizes(&self, kernel_sizes: &NSArray<NSNumber>);
430
431 /// Defines strides for spatial dimensions. Must be four numbers, one for each spatial dimension, fastest running index last.
432 ///
433 /// Default value: `
434 /// @
435 /// [
436 /// @
437 /// 1,
438 /// @
439 /// 1,
440 /// @
441 /// 1,
442 /// @
443 /// 1 ]`
444 #[unsafe(method(strides))]
445 #[unsafe(method_family = none)]
446 pub unsafe fn strides(&self) -> Retained<NSArray<NSNumber>>;
447
448 /// Setter for [`strides`][Self::strides].
449 ///
450 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
451 #[unsafe(method(setStrides:))]
452 #[unsafe(method_family = none)]
453 pub unsafe fn setStrides(&self, strides: &NSArray<NSNumber>);
454
455 /// Defines dilation rates for spatial dimensions. Must be four numbers, one for each spatial dimension, fastest running index last.
456 ///
457 /// Default value: `
458 /// @
459 /// [
460 /// @
461 /// 1,
462 /// @
463 /// 1,
464 /// @
465 /// 1,
466 /// @
467 /// 1 ]`
468 #[unsafe(method(dilationRates))]
469 #[unsafe(method_family = none)]
470 pub unsafe fn dilationRates(&self) -> Retained<NSArray<NSNumber>>;
471
472 /// Setter for [`dilationRates`][Self::dilationRates].
473 ///
474 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
475 #[unsafe(method(setDilationRates:))]
476 #[unsafe(method_family = none)]
477 pub unsafe fn setDilationRates(&self, dilation_rates: &NSArray<NSNumber>);
478
479 /// Defines padding values for spatial dimensions which must be eight numbers, two for each spatial dimension.
480 ///
481 /// For example `paddingValues[0]` defines the explicit padding
482 /// amount before the first spatial dimension (slowest running index of spatial dimensions),
483 /// `paddingValues[1]` defines the padding amount after the first spatial dimension etc.
484 /// Used only when `paddingStyle = MPSGraphPaddingStyleExplicit`.
485 /// Default value: `
486 /// @
487 /// [
488 /// @
489 /// 0,
490 /// @
491 /// 0,
492 /// @
493 /// 0,
494 /// @
495 /// 0,
496 /// @
497 /// 0,
498 /// @
499 /// 0,
500 /// @
501 /// 0,
502 /// @
503 /// 0 ]`
504 #[unsafe(method(paddingValues))]
505 #[unsafe(method_family = none)]
506 pub unsafe fn paddingValues(&self) -> Retained<NSArray<NSNumber>>;
507
508 /// Setter for [`paddingValues`][Self::paddingValues].
509 ///
510 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
511 #[unsafe(method(setPaddingValues:))]
512 #[unsafe(method_family = none)]
513 pub unsafe fn setPaddingValues(&self, padding_values: &NSArray<NSNumber>);
514
515 /// Defines what kind of padding graph applies to the operation.
516 ///
517 /// Default value: `MPSGraphPaddingStyleExplicit`.
518 #[unsafe(method(paddingStyle))]
519 #[unsafe(method_family = none)]
520 pub unsafe fn paddingStyle(&self) -> MPSGraphPaddingStyle;
521
522 /// Setter for [`paddingStyle`][Self::paddingStyle].
523 #[unsafe(method(setPaddingStyle:))]
524 #[unsafe(method_family = none)]
525 pub unsafe fn setPaddingStyle(&self, padding_style: MPSGraphPaddingStyle);
526
527 /// Affects how MPSGraph computes the output size: if set to `YES` then output size is
528 /// computed by rounding up instead of down when dividing input size by stride.
529 ///
530 /// Default value: `NO`.
531 #[unsafe(method(ceilMode))]
532 #[unsafe(method_family = none)]
533 pub unsafe fn ceilMode(&self) -> bool;
534
535 /// Setter for [`ceilMode`][Self::ceilMode].
536 #[unsafe(method(setCeilMode:))]
537 #[unsafe(method_family = none)]
538 pub unsafe fn setCeilMode(&self, ceil_mode: bool);
539
540 /// Defines a mode for average pooling, where samples outside the input tensor count as
541 /// zeroes in the average computation.
542 ///
543 /// Otherwise the result is sum over samples divided by
544 /// number of samples that didn't come from padding.
545 /// Default value: `NO`.
546 #[unsafe(method(includeZeroPadToAverage))]
547 #[unsafe(method_family = none)]
548 pub unsafe fn includeZeroPadToAverage(&self) -> bool;
549
550 /// Setter for [`includeZeroPadToAverage`][Self::includeZeroPadToAverage].
551 #[unsafe(method(setIncludeZeroPadToAverage:))]
552 #[unsafe(method_family = none)]
553 pub unsafe fn setIncludeZeroPadToAverage(&self, include_zero_pad_to_average: bool);
554
555 /// Defines the mode for returned indices of maximum values within each pooling window.
556 ///
557 /// Use this in conjunction with ``MPSGraph/maxPooling4DReturnIndicesWithSourceTensor:descriptor:name:`` API.
558 /// If `returnIndicesMode = MPSGraphPoolingReturnIndicesNone` then only the first result
559 /// MPSGraph returns from ``MPSGraph/maxPooling4DReturnIndicesWithSourceTensor:descriptor:name:``
560 /// will be valid and using the second result will assert.
561 /// Default value: `MPSGraphPoolingReturnIndicesNone`.
562 #[unsafe(method(returnIndicesMode))]
563 #[unsafe(method_family = none)]
564 pub unsafe fn returnIndicesMode(&self) -> MPSGraphPoolingReturnIndicesMode;
565
566 /// Setter for [`returnIndicesMode`][Self::returnIndicesMode].
567 #[unsafe(method(setReturnIndicesMode:))]
568 #[unsafe(method_family = none)]
569 pub unsafe fn setReturnIndicesMode(
570 &self,
571 return_indices_mode: MPSGraphPoolingReturnIndicesMode,
572 );
573
574 #[cfg(feature = "objc2-metal-performance-shaders")]
575 /// Defines the data type for returned indices.
576 ///
577 /// Use this in conjunction with ``MPSGraph/maxPooling4DReturnIndicesWithSourceTensor:descriptor:name:`` API.
578 /// Currently MPSGraph supports the following datatypes: `MPSDataTypeInt32`.
579 /// Default value: `MPSDataTypeInt32`.
580 #[unsafe(method(returnIndicesDataType))]
581 #[unsafe(method_family = none)]
582 pub unsafe fn returnIndicesDataType(&self) -> MPSDataType;
583
584 #[cfg(feature = "objc2-metal-performance-shaders")]
585 /// Setter for [`returnIndicesDataType`][Self::returnIndicesDataType].
586 #[unsafe(method(setReturnIndicesDataType:))]
587 #[unsafe(method_family = none)]
588 pub unsafe fn setReturnIndicesDataType(&self, return_indices_data_type: MPSDataType);
589
590 /// Creates a 4D pooling descriptor with given values.
591 ///
592 /// - Parameters:
593 /// - kernelSizes: See `kernelSizes` property.
594 /// - strides: See `strides` property.
595 /// - dilationRates: See `dilationRates` property.
596 /// - paddingValues: See `paddingValues` property.
597 /// - paddingStyle: See `paddingStyle` property.
598 /// - Returns: The descriptor on autoreleasepool.
599 #[unsafe(method(descriptorWithKernelSizes:strides:dilationRates:paddingValues:paddingStyle:))]
600 #[unsafe(method_family = none)]
601 pub unsafe fn descriptorWithKernelSizes_strides_dilationRates_paddingValues_paddingStyle(
602 kernel_sizes: &NSArray<NSNumber>,
603 strides: &NSArray<NSNumber>,
604 dilation_rates: &NSArray<NSNumber>,
605 padding_values: &NSArray<NSNumber>,
606 padding_style: MPSGraphPaddingStyle,
607 ) -> Option<Retained<Self>>;
608
609 /// Creates a 4D pooling descriptor with default values.
610 ///
611 /// - Parameters:
612 /// - kernelSizes: See `kernelSizes` property.
613 /// - paddingStyle: See `paddingStyle` property.
614 /// - Returns: The descriptor on autoreleasepool.
615 #[unsafe(method(descriptorWithKernelSizes:paddingStyle:))]
616 #[unsafe(method_family = none)]
617 pub unsafe fn descriptorWithKernelSizes_paddingStyle(
618 kernel_sizes: &NSArray<NSNumber>,
619 padding_style: MPSGraphPaddingStyle,
620 ) -> Option<Retained<Self>>;
621 );
622}
623
624/// Methods declared on superclass `NSObject`.
625#[cfg(feature = "MPSGraphCore")]
626impl MPSGraphPooling4DOpDescriptor {
627 extern_methods!(
628 #[unsafe(method(init))]
629 #[unsafe(method_family = init)]
630 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
631
632 #[unsafe(method(new))]
633 #[unsafe(method_family = new)]
634 pub unsafe fn new() -> Retained<Self>;
635 );
636}
637
638/// MPSGraphPoolingOps.
639#[cfg(all(feature = "MPSGraph", feature = "MPSGraphCore"))]
640impl MPSGraph {
641 extern_methods!(
642 #[cfg(feature = "MPSGraphTensor")]
643 /// Creates a 2D max-pooling operation and returns the result tensor.
644 ///
645 /// - Parameters:
646 /// - source: A 2D Image source as tensor - must be of rank=4. The layout is defined by `descriptor.dataLayout`.
647 /// - descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates, paddings and layouts.
648 /// - name: The name for the operation.
649 /// - Returns: A valid MPSGraphTensor object
650 #[unsafe(method(maxPooling2DWithSourceTensor:descriptor:name:))]
651 #[unsafe(method_family = none)]
652 pub unsafe fn maxPooling2DWithSourceTensor_descriptor_name(
653 &self,
654 source: &MPSGraphTensor,
655 descriptor: &MPSGraphPooling2DOpDescriptor,
656 name: Option<&NSString>,
657 ) -> Retained<MPSGraphTensor>;
658
659 #[cfg(feature = "MPSGraphTensor")]
660 /// Creates a 2D max-pooling operation and returns the result tensor and the corresponding indices tensor.
661 ///
662 /// In order to Computes the indices, `returnIndicesMode` of the descriptor must be set. The datatype of indices tensor can be set
663 /// using `returnIndicesDataType`.
664 /// If `returnIndicesMode = MPSGraphPoolingReturnIndicesNone` then only the first result
665 /// MPSGraph returns will be valid and using the second result will assert.
666 ///
667 /// - Parameters:
668 /// - source: A 2D Image source as tensor - must be of rank=4. The layout is defined by `descriptor.dataLayout`.
669 /// - descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates, paddings and layouts.
670 /// - name: The name for the operation.
671 /// - Returns: An array of two MPSGraphTensors. The first tensor holds the result of max pool and the second tensor holds the corresponding indices
672 #[unsafe(method(maxPooling2DReturnIndicesWithSourceTensor:descriptor:name:))]
673 #[unsafe(method_family = none)]
674 pub unsafe fn maxPooling2DReturnIndicesWithSourceTensor_descriptor_name(
675 &self,
676 source: &MPSGraphTensor,
677 descriptor: &MPSGraphPooling2DOpDescriptor,
678 name: Option<&NSString>,
679 ) -> Retained<NSArray<MPSGraphTensor>>;
680
681 #[cfg(feature = "MPSGraphTensor")]
682 /// Creates a max-pooling gradient operation and returns the result tensor.
683 ///
684 /// - Parameters:
685 /// - gradient: A 2D input gradient tensor - must be of rank=4. The layout is defined by `descriptor.dataLayout`.
686 /// - source: The input tensor for the forward pass.
687 /// - descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates, paddings and layouts.
688 /// - name: The name for the operation.
689 /// - Returns: A valid MPSGraphTensor object
690 #[unsafe(method(maxPooling2DGradientWithGradientTensor:sourceTensor:descriptor:name:))]
691 #[unsafe(method_family = none)]
692 pub unsafe fn maxPooling2DGradientWithGradientTensor_sourceTensor_descriptor_name(
693 &self,
694 gradient: &MPSGraphTensor,
695 source: &MPSGraphTensor,
696 descriptor: &MPSGraphPooling2DOpDescriptor,
697 name: Option<&NSString>,
698 ) -> Retained<MPSGraphTensor>;
699
700 #[cfg(all(
701 feature = "MPSGraphTensor",
702 feature = "objc2-metal-performance-shaders"
703 ))]
704 /// Creates a max-pooling gradient operation and returns the result tensor.
705 ///
706 /// With this API MPSGraph computes the max-pooling gradient efficiently by reusing the indices from the forward API instead of recomputing them.
707 /// The descriptor must set `returnIndicesMode` and `returnIndicesDataType` to the same value as that set by the forward pass.
708 ///
709 /// - Parameters:
710 /// - gradient: A 2D input gradient tensor - must be of rank=4. The layout is defined by `descriptor.dataLayout`.
711 /// - indices: The indices tensor returned from ``MPSGraph/maxPooling2DReturnIndicesWithSourceTensor:descriptor:name:``.
712 /// - outputShape: The shape of the destination gradient.
713 /// - descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates, paddings and layouts.
714 /// - name: The name for the operation.
715 /// - Returns: Destination gradient tensor.
716 #[unsafe(method(maxPooling2DGradientWithGradientTensor:indicesTensor:outputShape:descriptor:name:))]
717 #[unsafe(method_family = none)]
718 pub unsafe fn maxPooling2DGradientWithGradientTensor_indicesTensor_outputShape_descriptor_name(
719 &self,
720 gradient: &MPSGraphTensor,
721 indices: &MPSGraphTensor,
722 output_shape: &MPSShape,
723 descriptor: &MPSGraphPooling2DOpDescriptor,
724 name: Option<&NSString>,
725 ) -> Retained<MPSGraphTensor>;
726
727 #[cfg(feature = "MPSGraphTensor")]
728 /// Creates a max-pooling gradient operation and returns the result tensor.
729 ///
730 /// With this API MPSGraph computes the max-pooling gradient efficiently by reusing the indices from the forward API instead of recomputing them.
731 /// The descriptor must set `returnIndicesMode` and `returnIndicesDataType` to the same value as that set by the forward pass.
732 ///
733 /// - Parameters:
734 /// - gradient: A 2D input gradient tensor - must be of rank=4. The layout is defined by `descriptor.dataLayout`.
735 /// - indices: The indices tensor returned from ``MPSGraph/maxPooling2DReturnIndicesWithSourceTensor:descriptor:name:``.
736 /// - outputShape: A tensor containing the shape of the destination gradient.
737 /// - descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates, paddings and layouts.
738 /// - name: The name for the operation.
739 /// - Returns: Destination gradient tensor.
740 #[unsafe(method(maxPooling2DGradientWithGradientTensor:indicesTensor:outputShapeTensor:descriptor:name:))]
741 #[unsafe(method_family = none)]
742 pub unsafe fn maxPooling2DGradientWithGradientTensor_indicesTensor_outputShapeTensor_descriptor_name(
743 &self,
744 gradient: &MPSGraphTensor,
745 indices: &MPSGraphTensor,
746 output_shape: &MPSGraphTensor,
747 descriptor: &MPSGraphPooling2DOpDescriptor,
748 name: Option<&NSString>,
749 ) -> Retained<MPSGraphTensor>;
750
751 #[cfg(feature = "MPSGraphTensor")]
752 /// Creates a 2D average-pooling operation and returns the result tensor.
753 ///
754 /// - Parameters:
755 /// - source: A 2D Image source as tensor - must be of rank=4. The layout is defined by `descriptor.dataLayout`.
756 /// - descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates, paddings and layouts.
757 /// - name: The name for the operation.
758 /// - Returns: A valid MPSGraphTensor object
759 #[unsafe(method(avgPooling2DWithSourceTensor:descriptor:name:))]
760 #[unsafe(method_family = none)]
761 pub unsafe fn avgPooling2DWithSourceTensor_descriptor_name(
762 &self,
763 source: &MPSGraphTensor,
764 descriptor: &MPSGraphPooling2DOpDescriptor,
765 name: Option<&NSString>,
766 ) -> Retained<MPSGraphTensor>;
767
768 #[cfg(feature = "MPSGraphTensor")]
769 /// Creates a 2D average pooling gradient operation and returns the result tensor.
770 ///
771 /// - Parameters:
772 /// - gradient: A 2D input gradient tensor - must be of rank=4. The layout is defined by `descriptor.dataLayout`.
773 /// - source: The input tensor for the forward pass.
774 /// - descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates, paddings and layouts.
775 /// - name: The name for the operation.
776 /// - Returns: A valid MPSGraphTensor object
777 #[unsafe(method(avgPooling2DGradientWithGradientTensor:sourceTensor:descriptor:name:))]
778 #[unsafe(method_family = none)]
779 pub unsafe fn avgPooling2DGradientWithGradientTensor_sourceTensor_descriptor_name(
780 &self,
781 gradient: &MPSGraphTensor,
782 source: &MPSGraphTensor,
783 descriptor: &MPSGraphPooling2DOpDescriptor,
784 name: Option<&NSString>,
785 ) -> Retained<MPSGraphTensor>;
786
787 #[cfg(feature = "MPSGraphTensor")]
788 /// Creates a 4D max-pooling operation and returns the result tensor.
789 ///
790 /// - Parameters:
791 /// - source: A source tensor.
792 /// - descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates and paddings.
793 /// - name: The name for the operation.
794 /// - Returns: A valid MPSGraphTensor object
795 #[unsafe(method(maxPooling4DWithSourceTensor:descriptor:name:))]
796 #[unsafe(method_family = none)]
797 pub unsafe fn maxPooling4DWithSourceTensor_descriptor_name(
798 &self,
799 source: &MPSGraphTensor,
800 descriptor: &MPSGraphPooling4DOpDescriptor,
801 name: Option<&NSString>,
802 ) -> Retained<MPSGraphTensor>;
803
804 #[cfg(feature = "MPSGraphTensor")]
805 /// Creates a 4D max-pooling operation and returns the result tensor and the corresponding indices tensor.
806 ///
807 /// In order to Computes the indices, `returnIndicesMode` of the descriptor must be set. The datatype of indices tensor can be set
808 /// using `returnIndicesDataType`.
809 /// If `returnIndicesMode = MPSGraphPoolingReturnIndicesNone` then only the first result
810 /// MPSGraph returns will be valid and using the second result will assert.
811 ///
812 /// - Parameters:
813 /// - source: The source tensor on which pooling will be performed.
814 /// - descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates and paddings.
815 /// - name: The name for the operation.
816 /// - Returns: An array of two MPSGraphTensors. The first tensor holds the result of max pool and the second tensor holds the corresponding indices.
817 #[unsafe(method(maxPooling4DReturnIndicesWithSourceTensor:descriptor:name:))]
818 #[unsafe(method_family = none)]
819 pub unsafe fn maxPooling4DReturnIndicesWithSourceTensor_descriptor_name(
820 &self,
821 source: &MPSGraphTensor,
822 descriptor: &MPSGraphPooling4DOpDescriptor,
823 name: Option<&NSString>,
824 ) -> Retained<NSArray<MPSGraphTensor>>;
825
826 #[cfg(feature = "MPSGraphTensor")]
827 /// Creates a max-pooling gradient operation and returns the result tensor.
828 ///
829 /// - Parameters:
830 /// - gradient: An input gradient tensor.
831 /// - source: The input tensor for the forward pass.
832 /// - descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates and paddings.
833 /// - name: The name for the operation.
834 /// - Returns: A valid MPSGraphTensor object.
835 #[unsafe(method(maxPooling4DGradientWithGradientTensor:sourceTensor:descriptor:name:))]
836 #[unsafe(method_family = none)]
837 pub unsafe fn maxPooling4DGradientWithGradientTensor_sourceTensor_descriptor_name(
838 &self,
839 gradient: &MPSGraphTensor,
840 source: &MPSGraphTensor,
841 descriptor: &MPSGraphPooling4DOpDescriptor,
842 name: Option<&NSString>,
843 ) -> Retained<MPSGraphTensor>;
844
845 #[cfg(all(
846 feature = "MPSGraphTensor",
847 feature = "objc2-metal-performance-shaders"
848 ))]
849 /// Creates a max-pooling gradient operation and returns the result tensor.
850 ///
851 /// With this API MPSGraph computes the max-pooling gradient efficiently by reusing the indices from the forward API instead of recomputing them.
852 /// The descriptor must set `returnIndicesMode` and `returnIndicesDataType` to the same value as that set by the forward pass.
853 ///
854 /// - Parameters:
855 /// - gradient: An input gradient tensor.
856 /// - indices: Indices tensor returned from ``MPSGraph/maxPooling4DReturnIndicesWithSourceTensor:descriptor:name:``.
857 /// - outputShape: The shape of the destination gradient.
858 /// - descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates, paddings and layouts.
859 /// - name: The name for the operation.
860 /// - Returns: Destination gradient tensor.
861 #[unsafe(method(maxPooling4DGradientWithGradientTensor:indicesTensor:outputShape:descriptor:name:))]
862 #[unsafe(method_family = none)]
863 pub unsafe fn maxPooling4DGradientWithGradientTensor_indicesTensor_outputShape_descriptor_name(
864 &self,
865 gradient: &MPSGraphTensor,
866 indices: &MPSGraphTensor,
867 output_shape: &MPSShape,
868 descriptor: &MPSGraphPooling4DOpDescriptor,
869 name: Option<&NSString>,
870 ) -> Retained<MPSGraphTensor>;
871
872 #[cfg(feature = "MPSGraphTensor")]
873 /// Creates a max-pooling gradient operation and returns the result tensor.
874 ///
875 /// With this API MPSGraph computes the max-pooling gradient efficiently by reusing the indices from the forward API instead of recomputing them.
876 /// The descriptor must set `returnIndicesMode` and `returnIndicesDataType` to the same value as that set by the forward pass.
877 ///
878 /// - Parameters:
879 /// - gradient: An input gradient tensor.
880 /// - indices: The indices tensor returned from ``MPSGraph/maxPooling4DReturnIndicesWithSourceTensor:descriptor:name:``.
881 /// - outputShape: A tensor containing the shape of the destination gradient.
882 /// - descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates, paddings and layouts.
883 /// - name: The name for the operation.
884 /// - Returns: Destination gradient tensor.
885 #[unsafe(method(maxPooling4DGradientWithGradientTensor:indicesTensor:outputShapeTensor:descriptor:name:))]
886 #[unsafe(method_family = none)]
887 pub unsafe fn maxPooling4DGradientWithGradientTensor_indicesTensor_outputShapeTensor_descriptor_name(
888 &self,
889 gradient: &MPSGraphTensor,
890 indices: &MPSGraphTensor,
891 output_shape: &MPSGraphTensor,
892 descriptor: &MPSGraphPooling4DOpDescriptor,
893 name: Option<&NSString>,
894 ) -> Retained<MPSGraphTensor>;
895
896 #[cfg(feature = "MPSGraphTensor")]
897 /// Creates a 4D average pooling operation and returns the result tensor.
898 ///
899 /// - Parameters:
900 /// - source: A source tensor.
901 /// - descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates and paddings.
902 /// - name: The name for the operation.
903 /// - Returns: A valid MPSGraphTensor object
904 #[unsafe(method(avgPooling4DWithSourceTensor:descriptor:name:))]
905 #[unsafe(method_family = none)]
906 pub unsafe fn avgPooling4DWithSourceTensor_descriptor_name(
907 &self,
908 source: &MPSGraphTensor,
909 descriptor: &MPSGraphPooling4DOpDescriptor,
910 name: Option<&NSString>,
911 ) -> Retained<MPSGraphTensor>;
912
913 #[cfg(feature = "MPSGraphTensor")]
914 /// Creates an average pooling gradient operation and returns the result tensor.
915 ///
916 /// - Parameters:
917 /// - gradient: An input gradient tensor.
918 /// - source: The input tensor for the forward pass.
919 /// - descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates and paddings.
920 /// - name: The name for the operation.
921 /// - Returns: A valid MPSGraphTensor object.
922 #[unsafe(method(avgPooling4DGradientWithGradientTensor:sourceTensor:descriptor:name:))]
923 #[unsafe(method_family = none)]
924 pub unsafe fn avgPooling4DGradientWithGradientTensor_sourceTensor_descriptor_name(
925 &self,
926 gradient: &MPSGraphTensor,
927 source: &MPSGraphTensor,
928 descriptor: &MPSGraphPooling4DOpDescriptor,
929 name: Option<&NSString>,
930 ) -> Retained<MPSGraphTensor>;
931
932 #[cfg(feature = "MPSGraphTensor")]
933 /// Creates a 4D L2-norm pooling operation and returns the result tensor.
934 ///
935 /// - Parameters:
936 /// - source: A source tensor.
937 /// - descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates and paddings.
938 /// - name: The name for the operation.
939 /// - Returns: A valid MPSGraphTensor object
940 #[unsafe(method(L2NormPooling4DWithSourceTensor:descriptor:name:))]
941 #[unsafe(method_family = none)]
942 pub unsafe fn L2NormPooling4DWithSourceTensor_descriptor_name(
943 &self,
944 source: &MPSGraphTensor,
945 descriptor: &MPSGraphPooling4DOpDescriptor,
946 name: Option<&NSString>,
947 ) -> Retained<MPSGraphTensor>;
948
949 #[cfg(feature = "MPSGraphTensor")]
950 /// Creates a L2-Norm pooling gradient operation and returns the result tensor.
951 ///
952 /// - Parameters:
953 /// - gradient: An input gradient tensor.
954 /// - source: The input tensor for the forward pass.
955 /// - descriptor: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates and paddings.
956 /// - name: The name for the operation.
957 /// - Returns: A valid MPSGraphTensor object.
958 #[unsafe(method(L2NormPooling4DGradientWithGradientTensor:sourceTensor:descriptor:name:))]
959 #[unsafe(method_family = none)]
960 pub unsafe fn L2NormPooling4DGradientWithGradientTensor_sourceTensor_descriptor_name(
961 &self,
962 gradient: &MPSGraphTensor,
963 source: &MPSGraphTensor,
964 descriptor: &MPSGraphPooling4DOpDescriptor,
965 name: Option<&NSString>,
966 ) -> Retained<MPSGraphTensor>;
967 );
968}