Trait burn::tensor::ops::QTensorOps
pub trait QTensorOps<B>where
B: Backend,{
// Required methods
fn q_from_data<const D: usize>(
data: TensorData,
device: &<B as Backend>::Device,
) -> <B as Backend>::QuantizedTensorPrimitive<D>;
fn quantize<const D: usize>(
tensor: <B as Backend>::FloatTensorPrimitive<D>,
scheme: &QuantizationScheme,
qparams: QuantizationParametersPrimitive<B>,
) -> <B as Backend>::QuantizedTensorPrimitive<D>;
fn dequantize<const D: usize>(
tensor: <B as Backend>::QuantizedTensorPrimitive<D>,
) -> <B as Backend>::FloatTensorPrimitive<D>;
fn q_shape<const D: usize>(
tensor: &<B as Backend>::QuantizedTensorPrimitive<D>,
) -> Shape<D>;
fn q_device<const D: usize>(
tensor: &<B as Backend>::QuantizedTensorPrimitive<D>,
) -> <B as Backend>::Device;
fn q_reshape<const D1: usize, const D2: usize>(
tensor: <B as Backend>::QuantizedTensorPrimitive<D1>,
shape: Shape<D2>,
) -> <B as Backend>::QuantizedTensorPrimitive<D2>;
fn q_into_data<const D: usize>(
tensor: <B as Backend>::QuantizedTensorPrimitive<D>,
) -> impl Future<Output = TensorData> + Send;
// Provided methods
fn q_set_require_grad<const D: usize>(
tensor: <B as Backend>::QuantizedTensorPrimitive<D>,
_require_grad: bool,
) -> <B as Backend>::QuantizedTensorPrimitive<D> { ... }
fn q_is_require_grad<const D: usize>(
_tensor: &<B as Backend>::QuantizedTensorPrimitive<D>,
) -> bool { ... }
}
Expand description
Quantized Tensor API for basic operations, see tensor for documentation on each function.
Required Methods§
fn q_from_data<const D: usize>(
data: TensorData,
device: &<B as Backend>::Device,
) -> <B as Backend>::QuantizedTensorPrimitive<D>
fn q_from_data<const D: usize>( data: TensorData, device: &<B as Backend>::Device, ) -> <B as Backend>::QuantizedTensorPrimitive<D>
fn quantize<const D: usize>(
tensor: <B as Backend>::FloatTensorPrimitive<D>,
scheme: &QuantizationScheme,
qparams: QuantizationParametersPrimitive<B>,
) -> <B as Backend>::QuantizedTensorPrimitive<D>
fn quantize<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, scheme: &QuantizationScheme, qparams: QuantizationParametersPrimitive<B>, ) -> <B as Backend>::QuantizedTensorPrimitive<D>
Convert the tensor to a lower precision data type based on the quantization scheme and parameters.
fn dequantize<const D: usize>(
tensor: <B as Backend>::QuantizedTensorPrimitive<D>,
) -> <B as Backend>::FloatTensorPrimitive<D>
fn dequantize<const D: usize>( tensor: <B as Backend>::QuantizedTensorPrimitive<D>, ) -> <B as Backend>::FloatTensorPrimitive<D>
Convert the tensor back to a higher precision data type.
fn q_shape<const D: usize>(
tensor: &<B as Backend>::QuantizedTensorPrimitive<D>,
) -> Shape<D>
fn q_shape<const D: usize>( tensor: &<B as Backend>::QuantizedTensorPrimitive<D>, ) -> Shape<D>
fn q_device<const D: usize>(
tensor: &<B as Backend>::QuantizedTensorPrimitive<D>,
) -> <B as Backend>::Device
fn q_device<const D: usize>( tensor: &<B as Backend>::QuantizedTensorPrimitive<D>, ) -> <B as Backend>::Device
fn q_reshape<const D1: usize, const D2: usize>(
tensor: <B as Backend>::QuantizedTensorPrimitive<D1>,
shape: Shape<D2>,
) -> <B as Backend>::QuantizedTensorPrimitive<D2>
fn q_reshape<const D1: usize, const D2: usize>( tensor: <B as Backend>::QuantizedTensorPrimitive<D1>, shape: Shape<D2>, ) -> <B as Backend>::QuantizedTensorPrimitive<D2>
fn q_into_data<const D: usize>(
tensor: <B as Backend>::QuantizedTensorPrimitive<D>,
) -> impl Future<Output = TensorData> + Send
fn q_into_data<const D: usize>( tensor: <B as Backend>::QuantizedTensorPrimitive<D>, ) -> impl Future<Output = TensorData> + Send
Provided Methods§
fn q_set_require_grad<const D: usize>(
tensor: <B as Backend>::QuantizedTensorPrimitive<D>,
_require_grad: bool,
) -> <B as Backend>::QuantizedTensorPrimitive<D>
fn q_set_require_grad<const D: usize>( tensor: <B as Backend>::QuantizedTensorPrimitive<D>, _require_grad: bool, ) -> <B as Backend>::QuantizedTensorPrimitive<D>
Sets the require_grad
flag of a tensor.
fn q_is_require_grad<const D: usize>(
_tensor: &<B as Backend>::QuantizedTensorPrimitive<D>,
) -> bool
fn q_is_require_grad<const D: usize>( _tensor: &<B as Backend>::QuantizedTensorPrimitive<D>, ) -> bool
Returns the require_grad
flag of a tensor.
Object Safety§
This trait is not object safe.