objc2_ml_compute/generated/MLCGramMatrixLayer.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::*;
6
7use crate::*;
8
9extern_class!(
10 /// A gram matrix layer
11 ///
12 /// The MLComputeGramMatrix specifies a layer which computes the uncentered cross-correlation
13 /// values between the spatial planes of each feature channel of a tensor. If the input tensor batch is
14 /// x = x[b, y, x, c], where 'b' is batch index, 'y' and 'x' are the spatial coordinates and 'c' is the feature channel
15 /// index then this layer computes the values:
16 ///
17 /// y = y[b, 1, f, c] = alpha * sum_{x,y} x[b,y,x,f] * x[b,y,x,c], where 'alpha' is a scaling factor.
18 ///
19 /// This operation can be interpreted to be computing all combinations of fully connected layers
20 /// between the different spatial planes of the input tensor. The results are stored in the feature channel and
21 /// 'x'-coordinate indices of the output batch.
22 ///
23 /// The operation is performed independently for each tensor in a batch.
24 ///
25 /// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcgrammatrixlayer?language=objc)
26 #[unsafe(super(MLCLayer, NSObject))]
27 #[derive(Debug, PartialEq, Eq, Hash)]
28 #[cfg(feature = "MLCLayer")]
29 #[deprecated]
30 pub struct MLCGramMatrixLayer;
31);
32
33#[cfg(feature = "MLCLayer")]
34extern_conformance!(
35 unsafe impl NSObjectProtocol for MLCGramMatrixLayer {}
36);
37
38#[cfg(feature = "MLCLayer")]
39impl MLCGramMatrixLayer {
40 extern_methods!(
41 /// The scale factor
42 #[deprecated]
43 #[unsafe(method(scale))]
44 #[unsafe(method_family = none)]
45 pub unsafe fn scale(&self) -> c_float;
46
47 /// Create a GramMatrix layer
48 ///
49 /// Parameter `scale`: The scaling factor for the output.
50 ///
51 /// Returns: A new GramMatrix layer
52 #[deprecated]
53 #[unsafe(method(layerWithScale:))]
54 #[unsafe(method_family = none)]
55 pub unsafe fn layerWithScale(scale: c_float) -> Retained<Self>;
56 );
57}
58
59/// Methods declared on superclass `MLCLayer`.
60#[cfg(feature = "MLCLayer")]
61impl MLCGramMatrixLayer {
62 extern_methods!(
63 #[deprecated]
64 #[unsafe(method(new))]
65 #[unsafe(method_family = new)]
66 pub unsafe fn new() -> Retained<Self>;
67
68 #[deprecated]
69 #[unsafe(method(init))]
70 #[unsafe(method_family = init)]
71 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
72 );
73}