objc2-ml-compute 0.3.2

Bindings to the MLCompute framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// The MLCTensorDescriptor specifies a tensor descriptor.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlctensordescriptor?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated]
    pub struct MLCTensorDescriptor;
);

extern_conformance!(
    unsafe impl NSCopying for MLCTensorDescriptor {}
);

unsafe impl CopyingHelper for MLCTensorDescriptor {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for MLCTensorDescriptor {}
);

impl MLCTensorDescriptor {
    extern_methods!(
        #[cfg(feature = "MLCTypes")]
        /// The tensor data type.  The default is MLCDataTypeFloat32.
        #[deprecated]
        #[unsafe(method(dataType))]
        #[unsafe(method_family = none)]
        pub unsafe fn dataType(&self) -> MLCDataType;

        /// The number of dimensions in the tensor
        #[deprecated]
        #[unsafe(method(dimensionCount))]
        #[unsafe(method_family = none)]
        pub unsafe fn dimensionCount(&self) -> NSUInteger;

        /// The size in each dimension
        #[deprecated]
        #[unsafe(method(shape))]
        #[unsafe(method_family = none)]
        pub unsafe fn shape(&self) -> Retained<NSArray<NSNumber>>;

        /// The stride in bytes in each dimension
        #[deprecated]
        #[unsafe(method(stride))]
        #[unsafe(method_family = none)]
        pub unsafe fn stride(&self) -> Retained<NSArray<NSNumber>>;

        /// The allocation size in bytes for a tensor.
        #[deprecated]
        #[unsafe(method(tensorAllocationSizeInBytes))]
        #[unsafe(method_family = none)]
        pub unsafe fn tensorAllocationSizeInBytes(&self) -> NSUInteger;

        /// TODO
        #[deprecated]
        #[unsafe(method(sequenceLengths))]
        #[unsafe(method_family = none)]
        pub unsafe fn sequenceLengths(&self) -> Option<Retained<NSArray<NSNumber>>>;

        /// Specifies whether the sequences are sorted or not.
        #[deprecated]
        #[unsafe(method(sortedSequences))]
        #[unsafe(method_family = none)]
        pub unsafe fn sortedSequences(&self) -> bool;

        /// The batch size for each sequence
        ///
        /// We populate this only when sequenceLengths is valid. The length of this array should be
        /// the maximum sequence length in sequenceLengths (i.e sequenceLengths[0]).
        #[deprecated]
        #[unsafe(method(batchSizePerSequenceStep))]
        #[unsafe(method_family = none)]
        pub unsafe fn batchSizePerSequenceStep(&self) -> Option<Retained<NSArray<NSNumber>>>;

        #[deprecated]
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        #[deprecated]
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        /// The maximum number of tensor dimensions supported
        #[deprecated]
        #[unsafe(method(maxTensorDimensions))]
        #[unsafe(method_family = none)]
        pub unsafe fn maxTensorDimensions() -> NSUInteger;

        #[cfg(feature = "MLCTypes")]
        /// Create a MLCTensorDescriptor object
        ///
        /// Parameter `shape`: The tensor shape
        ///
        /// Parameter `dataType`: The tensor data type
        ///
        /// Returns: A new MLCTensorDescriptor object or nil if failure.
        #[deprecated]
        #[unsafe(method(descriptorWithShape:dataType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn descriptorWithShape_dataType(
            shape: &NSArray<NSNumber>,
            data_type: MLCDataType,
        ) -> Option<Retained<Self>>;

        #[cfg(feature = "MLCTypes")]
        /// Create a MLCTensorDescriptor object
        ///
        /// Parameter `shape`: The tensor shape
        ///
        /// Parameter `sequenceLengths`: The sequence lengths in tensor
        ///
        /// Parameter `sortedSequences`: A boolean to indicate whether sequences are sorted
        ///
        /// Parameter `dataType`: The tensor data type
        ///
        /// Returns: A new MLCTensorDescriptor object or nil if failure.
        ///
        /// This method is provided as an easy to use API to create sequence tensors used by recurrent layers.
        #[deprecated]
        #[unsafe(method(descriptorWithShape:sequenceLengths:sortedSequences:dataType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn descriptorWithShape_sequenceLengths_sortedSequences_dataType(
            shape: &NSArray<NSNumber>,
            sequence_lengths: &NSArray<NSNumber>,
            sorted_sequences: bool,
            data_type: MLCDataType,
        ) -> Option<Retained<Self>>;

        /// Create a MLCTensorDescriptor object
        ///
        /// Parameter `width`: The tensor width
        ///
        /// Parameter `height`: The tensor height
        ///
        /// Parameter `featureChannels`: The number of feature channels
        ///
        /// Parameter `batchSize`: The batch size
        ///
        /// Returns: A new MLCTensorDescriptor object or nil if failure.
        ///
        /// This method is provided as an easy to use API to create [NCHW] tensors used by convolutional layers.
        #[deprecated]
        #[unsafe(method(descriptorWithWidth:height:featureChannelCount:batchSize:))]
        #[unsafe(method_family = none)]
        pub unsafe fn descriptorWithWidth_height_featureChannelCount_batchSize(
            width: NSUInteger,
            height: NSUInteger,
            feature_channels: NSUInteger,
            batch_size: NSUInteger,
        ) -> Option<Retained<Self>>;

        #[cfg(feature = "MLCTypes")]
        /// Create a MLCTensorDescriptor object
        ///
        /// Parameter `width`: The tensor width
        ///
        /// Parameter `height`: The tensor height
        ///
        /// Parameter `featureChannelCount`: The number of feature channels
        ///
        /// Parameter `batchSize`: The batch size
        ///
        /// Parameter `dataType`: The tensor data type
        ///
        /// Returns: A new MLCTensorDescriptor object or nil if failure.
        ///
        /// This method is provided as an easy to use API to create [NCHW] tensors used by convolutional layers.
        #[deprecated]
        #[unsafe(method(descriptorWithWidth:height:featureChannelCount:batchSize:dataType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn descriptorWithWidth_height_featureChannelCount_batchSize_dataType(
            width: NSUInteger,
            height: NSUInteger,
            feature_channel_count: NSUInteger,
            batch_size: NSUInteger,
            data_type: MLCDataType,
        ) -> Option<Retained<Self>>;

        #[cfg(feature = "MLCTypes")]
        /// Create a MLCTensorDescriptor object
        ///
        /// Parameter `width`: The tensor width
        ///
        /// Parameter `height`: The tensor height
        ///
        /// Parameter `inputFeatureChannelCount`: The number of input feature channels
        ///
        /// Parameter `outputFeatureChannelCount`: The number of output feature channels
        ///
        /// Parameter `dataType`: The tensor data type
        ///
        /// Returns: A new MLCTensorDescriptor object or nil if failure.
        ///
        /// This method is provided as an easy to use API to create a weight tensor.
        #[deprecated]
        #[unsafe(method(convolutionWeightsDescriptorWithWidth:height:inputFeatureChannelCount:outputFeatureChannelCount:dataType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn convolutionWeightsDescriptorWithWidth_height_inputFeatureChannelCount_outputFeatureChannelCount_dataType(
            width: NSUInteger,
            height: NSUInteger,
            input_feature_channel_count: NSUInteger,
            output_feature_channel_count: NSUInteger,
            data_type: MLCDataType,
        ) -> Option<Retained<Self>>;

        #[cfg(feature = "MLCTypes")]
        /// Create a MLCTensorDescriptor object
        ///
        /// Parameter `inputFeatureChannelCount`: The number of input feature channels
        ///
        /// Parameter `outputFeatureChannelCount`: The number of output feature channels
        ///
        /// Parameter `dataType`: The tensor data type
        ///
        /// Returns: A new MLCTensorDescriptor object or nil if failure.
        ///
        /// This method is provided as an easy to use API to create a weight tensor for a kernel of size 1.
        #[deprecated]
        #[unsafe(method(convolutionWeightsDescriptorWithInputFeatureChannelCount:outputFeatureChannelCount:dataType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn convolutionWeightsDescriptorWithInputFeatureChannelCount_outputFeatureChannelCount_dataType(
            input_feature_channel_count: NSUInteger,
            output_feature_channel_count: NSUInteger,
            data_type: MLCDataType,
        ) -> Option<Retained<Self>>;

        #[cfg(feature = "MLCTypes")]
        /// Create a MLCTensorDescriptor object
        ///
        /// Parameter `featureChannelCount`: The number of input feature channels
        ///
        /// Parameter `dataType`: The tensor data type
        ///
        /// Returns: A new MLCTensorDescriptor object or nil if failure.
        ///
        /// This method is provided as an easy to use API to create a bias tensor.
        #[deprecated]
        #[unsafe(method(convolutionBiasesDescriptorWithFeatureChannelCount:dataType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn convolutionBiasesDescriptorWithFeatureChannelCount_dataType(
            feature_channel_count: NSUInteger,
            data_type: MLCDataType,
        ) -> Option<Retained<Self>>;
    );
}