objc2_metal_performance_shaders_graph/generated/
MPSGraphImToColOps.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    /// The class that defines the parameters for an image to column or column to image operation.
14    ///
15    /// Use this descriptor with the following ``MPSGraph`` methods:
16    /// - ``MPSGraph/imToColWithSourceTensor:descriptor:name:``
17    /// - ``MPSGraph/colToImWithSourceTensor:outputShape:descriptor:name:``
18    ///
19    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshadersgraph/mpsgraphimtocolopdescriptor?language=objc)
20    #[unsafe(super(MPSGraphObject, NSObject))]
21    #[derive(Debug, PartialEq, Eq, Hash)]
22    #[cfg(feature = "MPSGraphCore")]
23    pub struct MPSGraphImToColOpDescriptor;
24);
25
26#[cfg(feature = "MPSGraphCore")]
27extern_conformance!(
28    unsafe impl NSCopying for MPSGraphImToColOpDescriptor {}
29);
30
31#[cfg(feature = "MPSGraphCore")]
32unsafe impl CopyingHelper for MPSGraphImToColOpDescriptor {
33    type Result = Self;
34}
35
36#[cfg(feature = "MPSGraphCore")]
37extern_conformance!(
38    unsafe impl NSObjectProtocol for MPSGraphImToColOpDescriptor {}
39);
40
41#[cfg(feature = "MPSGraphCore")]
42impl MPSGraphImToColOpDescriptor {
43    extern_methods!(
44        /// The property that defines the kernel size in width dimension.
45        #[unsafe(method(kernelWidth))]
46        #[unsafe(method_family = none)]
47        pub unsafe fn kernelWidth(&self) -> NSUInteger;
48
49        /// Setter for [`kernelWidth`][Self::kernelWidth].
50        #[unsafe(method(setKernelWidth:))]
51        #[unsafe(method_family = none)]
52        pub unsafe fn setKernelWidth(&self, kernel_width: NSUInteger);
53
54        /// The property that defines the kernel size  in height dimension.
55        #[unsafe(method(kernelHeight))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn kernelHeight(&self) -> NSUInteger;
58
59        /// Setter for [`kernelHeight`][Self::kernelHeight].
60        #[unsafe(method(setKernelHeight:))]
61        #[unsafe(method_family = none)]
62        pub unsafe fn setKernelHeight(&self, kernel_height: NSUInteger);
63
64        /// The property that defines the stride in width dimension.
65        #[unsafe(method(strideInX))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn strideInX(&self) -> NSUInteger;
68
69        /// Setter for [`strideInX`][Self::strideInX].
70        #[unsafe(method(setStrideInX:))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn setStrideInX(&self, stride_in_x: NSUInteger);
73
74        /// The property that defines the stride in height dimension.
75        #[unsafe(method(strideInY))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn strideInY(&self) -> NSUInteger;
78
79        /// Setter for [`strideInY`][Self::strideInY].
80        #[unsafe(method(setStrideInY:))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn setStrideInY(&self, stride_in_y: NSUInteger);
83
84        /// The property that defines the dilation in width dimension.
85        #[unsafe(method(dilationRateInX))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn dilationRateInX(&self) -> NSUInteger;
88
89        /// Setter for [`dilationRateInX`][Self::dilationRateInX].
90        #[unsafe(method(setDilationRateInX:))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn setDilationRateInX(&self, dilation_rate_in_x: NSUInteger);
93
94        /// The property that defines the dilation in height dimension.
95        #[unsafe(method(dilationRateInY))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn dilationRateInY(&self) -> NSUInteger;
98
99        /// Setter for [`dilationRateInY`][Self::dilationRateInY].
100        #[unsafe(method(setDilationRateInY:))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn setDilationRateInY(&self, dilation_rate_in_y: NSUInteger);
103
104        /// The property that defines the padding in width dimension on the left side.
105        #[unsafe(method(paddingLeft))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn paddingLeft(&self) -> NSUInteger;
108
109        /// Setter for [`paddingLeft`][Self::paddingLeft].
110        #[unsafe(method(setPaddingLeft:))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn setPaddingLeft(&self, padding_left: NSUInteger);
113
114        /// The property that defines the padding in width dimension on the right side.
115        #[unsafe(method(paddingRight))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn paddingRight(&self) -> NSUInteger;
118
119        /// Setter for [`paddingRight`][Self::paddingRight].
120        #[unsafe(method(setPaddingRight:))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn setPaddingRight(&self, padding_right: NSUInteger);
123
124        /// The property that defines the padding in height dimension at the top.
125        #[unsafe(method(paddingTop))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn paddingTop(&self) -> NSUInteger;
128
129        /// Setter for [`paddingTop`][Self::paddingTop].
130        #[unsafe(method(setPaddingTop:))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn setPaddingTop(&self, padding_top: NSUInteger);
133
134        /// The property that defines the padding in height dimension at the bottom.
135        #[unsafe(method(paddingBottom))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn paddingBottom(&self) -> NSUInteger;
138
139        /// Setter for [`paddingBottom`][Self::paddingBottom].
140        #[unsafe(method(setPaddingBottom:))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn setPaddingBottom(&self, padding_bottom: NSUInteger);
143
144        /// The property that defines the layout of source or output  tensor.
145        /// e.g. `batch x channels x width x height` for `NCHW` layout
146        #[unsafe(method(dataLayout))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn dataLayout(&self) -> MPSGraphTensorNamedDataLayout;
149
150        /// Setter for [`dataLayout`][Self::dataLayout].
151        #[unsafe(method(setDataLayout:))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn setDataLayout(&self, data_layout: MPSGraphTensorNamedDataLayout);
154
155        /// Creates an image to column descriptor with given values for parameters.
156        /// - Parameters:
157        /// - kernelWidth: See `kernelWidth` property.
158        /// - kernelHeight: See `kernelHeight` property.
159        /// - strideInX: See `strideInX` property.
160        /// - strideInY: See `strideInY` property.
161        /// - dilationRateInX: See `dilationRateInX` property.
162        /// - dilationRateInY: See `dilationRateInY` property.
163        /// - paddingLeft: See `paddingLeft` property.
164        /// - paddingRight: See `paddingRight` property.
165        /// - paddingTop: See `paddingTop` property.
166        /// - paddingBottom: See `paddingBottom` property.
167        /// - dataLayout: See `dataLayout` property.
168        /// - Returns: A valid MPSGraphImToColOpDescriptor on autoreleasepool.
169        #[unsafe(method(descriptorWithKernelWidth:kernelHeight:strideInX:strideInY:dilationRateInX:dilationRateInY:paddingLeft:paddingRight:paddingTop:paddingBottom:dataLayout:))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn descriptorWithKernelWidth_kernelHeight_strideInX_strideInY_dilationRateInX_dilationRateInY_paddingLeft_paddingRight_paddingTop_paddingBottom_dataLayout(
172            kernel_width: NSUInteger,
173            kernel_height: NSUInteger,
174            stride_in_x: NSUInteger,
175            stride_in_y: NSUInteger,
176            dilation_rate_in_x: NSUInteger,
177            dilation_rate_in_y: NSUInteger,
178            padding_left: NSUInteger,
179            padding_right: NSUInteger,
180            padding_top: NSUInteger,
181            padding_bottom: NSUInteger,
182            data_layout: MPSGraphTensorNamedDataLayout,
183        ) -> Option<Retained<Self>>;
184
185        /// Creates column to image descriptor with given values for parameters.
186        /// - Parameters:
187        /// - kernelWidth: See `kernelWidth` property.
188        /// - kernelHeight: See `kernelHeight` property.
189        /// - strideInX: See `strideInX` property.
190        /// - strideInY: See `strideInY` property.
191        /// - dilationRateInX: See `dilationRateInX` property.
192        /// - dilationRateInY: See `dilationRateInY` property.
193        /// - dataLayout: See `dataLayout` property.
194        /// - Returns: A valid MPSGraphImToColOpDescriptor on autoreleasepool.
195        #[unsafe(method(descriptorWithKernelWidth:kernelHeight:strideInX:strideInY:dilationRateInX:dilationRateInY:dataLayout:))]
196        #[unsafe(method_family = none)]
197        pub unsafe fn descriptorWithKernelWidth_kernelHeight_strideInX_strideInY_dilationRateInX_dilationRateInY_dataLayout(
198            kernel_width: NSUInteger,
199            kernel_height: NSUInteger,
200            stride_in_x: NSUInteger,
201            stride_in_y: NSUInteger,
202            dilation_rate_in_x: NSUInteger,
203            dilation_rate_in_y: NSUInteger,
204            data_layout: MPSGraphTensorNamedDataLayout,
205        ) -> Option<Retained<Self>>;
206
207        /// Sets the descriptor's padding to the given values.
208        /// - Parameters:
209        /// - paddingLeft: See `paddingLeft` property.
210        /// - paddingRight: See `paddingRight` property.
211        /// - paddingTop: See `paddingTop` property.
212        /// - paddingBottom: See `paddingBottom` property.
213        #[unsafe(method(setExplicitPaddingWithPaddingLeft:paddingRight:paddingTop:paddingBottom:))]
214        #[unsafe(method_family = none)]
215        pub unsafe fn setExplicitPaddingWithPaddingLeft_paddingRight_paddingTop_paddingBottom(
216            &self,
217            padding_left: NSUInteger,
218            padding_right: NSUInteger,
219            padding_top: NSUInteger,
220            padding_bottom: NSUInteger,
221        );
222    );
223}
224
225/// Methods declared on superclass `NSObject`.
226#[cfg(feature = "MPSGraphCore")]
227impl MPSGraphImToColOpDescriptor {
228    extern_methods!(
229        #[unsafe(method(init))]
230        #[unsafe(method_family = init)]
231        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
232
233        #[unsafe(method(new))]
234        #[unsafe(method_family = new)]
235        pub unsafe fn new() -> Retained<Self>;
236    );
237}
238
239/// MPSGraphImToColOps.
240#[cfg(all(feature = "MPSGraph", feature = "MPSGraphCore"))]
241impl MPSGraph {
242    extern_methods!(
243        #[cfg(feature = "MPSGraphTensor")]
244        /// Creates an imToCol operation and returns the result tensor.
245        ///
246        /// - Parameters:
247        /// - source: The tensor containing the source data. Must be of rank 4. The layout is defined by `descriptor.dataLayout`.
248        /// - descriptor: The descriptor object that specifies the parameters of the operation.
249        /// - name: The name for the operation.
250        /// - Returns: A valid MPSGraphTensor object
251        #[unsafe(method(imToColWithSourceTensor:descriptor:name:))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn imToColWithSourceTensor_descriptor_name(
254            &self,
255            source: &MPSGraphTensor,
256            descriptor: &MPSGraphImToColOpDescriptor,
257            name: Option<&NSString>,
258        ) -> Retained<MPSGraphTensor>;
259
260        #[cfg(all(
261            feature = "MPSGraphTensor",
262            feature = "objc2-metal-performance-shaders"
263        ))]
264        /// Creates a column to image operation and returns the result tensor.
265        ///
266        /// - Parameters:
267        /// - source: The tensor containing the source data. Must be of rank 4. The layout is defined by `descriptor.dataLayout`.
268        /// - outputShape: The result tensor shape.
269        /// - descriptor: The descriptor object that specifies the parameters of the operation.
270        /// - name: The name for the operation.
271        /// - Returns: A valid MPSGraphTensor object
272        #[unsafe(method(colToImWithSourceTensor:outputShape:descriptor:name:))]
273        #[unsafe(method_family = none)]
274        pub unsafe fn colToImWithSourceTensor_outputShape_descriptor_name(
275            &self,
276            source: &MPSGraphTensor,
277            output_shape: &MPSShape,
278            descriptor: &MPSGraphImToColOpDescriptor,
279            name: Option<&NSString>,
280        ) -> Retained<MPSGraphTensor>;
281    );
282}