objc2_metal_performance_shaders_graph/generated/MPSGraphSampleGridOps.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
8use crate::*;
9
10/// MPSGraphSampleGrid.
11#[cfg(all(feature = "MPSGraph", feature = "MPSGraphCore"))]
12impl MPSGraph {
13 extern_methods!(
14 #[cfg(all(feature = "MPSGraphResizeOps", feature = "MPSGraphTensor"))]
15 /// Samples a tensor using the coordinates provided.
16 ///
17 /// Given an input tensor (N, H1, W1, C) or (N, C, H1, W1) and coordinates tensor (N, H2, W2, 2) this operation outputs a tensor of
18 /// size (N, H2, W2, C) or (N, C, H2, W2) by sampling the input tensor at the coordinates provided by the coordinates tensor.
19 ///
20 /// - Parameters:
21 /// - source: Tensor containing source data
22 /// - coordinates: a tensor (N, Hout, Wout, 2) that contains the coordinates of the samples in the source tensor that constitute the output tensor.
23 /// - layout: Specifies what layout the provided tensor is in. The returned tensor will follow the same layout. Valid layouts are NHWC and NCHW.
24 /// - normalizeCoordinates: If true, coordinates are within [-1, 1] x [-1, 1] otherwise they are in pixels in the input tensor.
25 /// - relativeCoordinates: If true, coordinates are relative to the postion of the pixel in the output tensor and scaled back to the input tensor size
26 /// - alignCorners: If true, coordinate extrema are equal to the center of edge pixels, otherwise extrema are equal to outer edge of edge pixels
27 /// - paddingMode: determines how samples outside the inputTensor are evaluated (only constant, reflect, symmetric and clampToEdge are supported)
28 /// - samplingMode: Can be either MPSGraphResizeNearest or MPSGraphResizeBilinear. Nearest sampling will use roundPreferCeil.
29 /// - constantValue: If paddingMode is MPSGraphPaddingModeConstant, then this constant is used for samples outside the input tensor.
30 /// - name: The name for the operation.
31 /// - Returns: A valid MPSGraphTensor object
32 #[unsafe(method(sampleGridWithSourceTensor:coordinateTensor:layout:normalizeCoordinates:relativeCoordinates:alignCorners:paddingMode:samplingMode:constantValue:name:))]
33 #[unsafe(method_family = none)]
34 pub unsafe fn sampleGridWithSourceTensor_coordinateTensor_layout_normalizeCoordinates_relativeCoordinates_alignCorners_paddingMode_samplingMode_constantValue_name(
35 &self,
36 source: &MPSGraphTensor,
37 coordinates: &MPSGraphTensor,
38 layout: MPSGraphTensorNamedDataLayout,
39 normalize_coordinates: bool,
40 relative_coordinates: bool,
41 align_corners: bool,
42 padding_mode: MPSGraphPaddingMode,
43 sampling_mode: MPSGraphResizeMode,
44 constant_value: c_double,
45 name: Option<&NSString>,
46 ) -> Retained<MPSGraphTensor>;
47
48 #[cfg(all(feature = "MPSGraphResizeOps", feature = "MPSGraphTensor"))]
49 /// Samples a tensor using the coordinates provided, using nearest neighbor sampling with specified rounding mode.
50 ///
51 /// Given an input tensor (N, H1, W1, C) or (N, C, H1, W1) and coordinates tensor (N, H2, W2, 2) this operation outputs a tensor of
52 /// size (N, H2, W2, C) or (N, C, H2, W2) by sampling the input tensor at the coordinates provided by the coordinates tensor.
53 ///
54 /// - Parameters:
55 /// - source: Tensor containing source data
56 /// - coordinates: a tensor (N, Hout, Wout, 2) that contains the coordinates of the samples in the source tensor that constitute the output tensor.
57 /// - layout: Specifies what layout the provided tensor is in. The returned tensor will follow the same layout. Valid layouts are NHWC and NCHW.
58 /// - normalizeCoordinates: If true, coordinates are within [-1, 1] x [-1, 1] otherwise they are in pixels in the input tensor.
59 /// - relativeCoordinates: If true, coordinates are relative to the postion of the pixel in the output tensor and scaled back to the input tensor size
60 /// - alignCorners: If true, coordinate extrema are equal to the center of edge pixels, otherwise extrema are equal to outer edge of edge pixels
61 /// - paddingMode: determines how samples outside the inputTensor are evaluated (only constant, reflect, symmetric and clampToEdge are supported)
62 /// - nearestRoundingMode: The rounding mode to use for determining the nearest neighbor. Valid modes are roundPreferCeil, roundPreferFloor, ceil, and floor.
63 /// - constantValue: If paddingMode is MPSGraphPaddingModeConstant, then this constant is used for samples outside the input tensor.
64 /// - name: The name for the operation.
65 /// - Returns: A valid MPSGraphTensor object
66 #[unsafe(method(sampleGridWithSourceTensor:coordinateTensor:layout:normalizeCoordinates:relativeCoordinates:alignCorners:paddingMode:nearestRoundingMode:constantValue:name:))]
67 #[unsafe(method_family = none)]
68 pub unsafe fn sampleGridWithSourceTensor_coordinateTensor_layout_normalizeCoordinates_relativeCoordinates_alignCorners_paddingMode_nearestRoundingMode_constantValue_name(
69 &self,
70 source: &MPSGraphTensor,
71 coordinates: &MPSGraphTensor,
72 layout: MPSGraphTensorNamedDataLayout,
73 normalize_coordinates: bool,
74 relative_coordinates: bool,
75 align_corners: bool,
76 padding_mode: MPSGraphPaddingMode,
77 nearest_rounding_mode: MPSGraphResizeNearestRoundingMode,
78 constant_value: c_double,
79 name: Option<&NSString>,
80 ) -> Retained<MPSGraphTensor>;
81 );
82}