pub trait QTensorOps<B: Backend> {
Show 78 methods
// Required methods
fn q_from_data(data: TensorData, device: &Device<B>) -> QuantizedTensor<B>;
fn quantize(
tensor: FloatTensor<B>,
scheme: &QuantScheme,
qparams: QuantizationParametersPrimitive<B>,
) -> QuantizedTensor<B>;
fn dequantize(tensor: QuantizedTensor<B>) -> FloatTensor<B>;
fn q_device(tensor: &QuantizedTensor<B>) -> Device<B>;
fn q_to_device(
tensor: QuantizedTensor<B>,
device: &Device<B>,
) -> QuantizedTensor<B>;
fn q_reshape(tensor: QuantizedTensor<B>, shape: Shape) -> QuantizedTensor<B>;
fn q_into_data(
tensor: QuantizedTensor<B>,
) -> impl Future<Output = TensorData> + Send;
fn q_expand(tensor: QuantizedTensor<B>, shape: Shape) -> QuantizedTensor<B>;
fn q_swap_dims(
tensor: QuantizedTensor<B>,
dim1: usize,
dim2: usize,
) -> QuantizedTensor<B>;
fn q_permute(
tensor: QuantizedTensor<B>,
axes: &[usize],
) -> QuantizedTensor<B>;
fn q_flip(tensor: QuantizedTensor<B>, axes: &[usize]) -> QuantizedTensor<B>;
fn q_select(
tensor: QuantizedTensor<B>,
dim: usize,
indices: IntTensor<B>,
) -> QuantizedTensor<B>;
fn q_slice(
tensor: QuantizedTensor<B>,
slices: &[Slice],
) -> QuantizedTensor<B>;
// Provided methods
fn quantize_dynamic(
tensor: FloatTensor<B>,
scheme: &QuantScheme,
) -> QuantizedTensor<B> { ... }
fn q_detach(tensor: QuantizedTensor<B>) -> QuantizedTensor<B> { ... }
fn q_set_require_grad(
tensor: QuantizedTensor<B>,
_require_grad: bool,
) -> QuantizedTensor<B> { ... }
fn q_is_require_grad(_tensor: &QuantizedTensor<B>) -> bool { ... }
fn q_transpose(tensor: QuantizedTensor<B>) -> QuantizedTensor<B> { ... }
fn q_gather(
dim: usize,
tensor: QuantizedTensor<B>,
indices: IntTensor<B>,
) -> QuantizedTensor<B> { ... }
fn q_repeat_dim(
tensor: QuantizedTensor<B>,
dim: usize,
times: usize,
) -> QuantizedTensor<B> { ... }
fn q_add(
lhs: QuantizedTensor<B>,
rhs: QuantizedTensor<B>,
) -> TensorPrimitive<B> { ... }
fn q_add_scalar(
lhs: QuantizedTensor<B>,
rhs: FloatElem<B>,
) -> TensorPrimitive<B> { ... }
fn q_clamp_min(
tensor: QuantizedTensor<B>,
min: FloatElem<B>,
) -> TensorPrimitive<B> { ... }
fn q_clamp_max(
tensor: QuantizedTensor<B>,
max: FloatElem<B>,
) -> TensorPrimitive<B> { ... }
fn q_clamp(
tensor: QuantizedTensor<B>,
min: FloatElem<B>,
max: FloatElem<B>,
) -> TensorPrimitive<B> { ... }
fn q_sub(
lhs: QuantizedTensor<B>,
rhs: QuantizedTensor<B>,
) -> TensorPrimitive<B> { ... }
fn q_sub_scalar(
lhs: QuantizedTensor<B>,
rhs: FloatElem<B>,
) -> TensorPrimitive<B> { ... }
fn q_mul(
lhs: QuantizedTensor<B>,
rhs: QuantizedTensor<B>,
) -> TensorPrimitive<B> { ... }
fn q_mul_scalar(
lhs: QuantizedTensor<B>,
rhs: FloatElem<B>,
) -> TensorPrimitive<B> { ... }
fn q_div(
lhs: QuantizedTensor<B>,
rhs: QuantizedTensor<B>,
) -> TensorPrimitive<B> { ... }
fn q_div_scalar(
lhs: QuantizedTensor<B>,
rhs: FloatElem<B>,
) -> TensorPrimitive<B> { ... }
fn q_matmul(
lhs: TensorPrimitive<B>,
rhs: TensorPrimitive<B>,
) -> TensorPrimitive<B> { ... }
fn q_neg(tensor: QuantizedTensor<B>) -> TensorPrimitive<B> { ... }
fn q_recip(tensor: QuantizedTensor<B>) -> TensorPrimitive<B> { ... }
fn q_sum(tensor: QuantizedTensor<B>) -> TensorPrimitive<B> { ... }
fn q_sum_dim(tensor: QuantizedTensor<B>, dim: usize) -> TensorPrimitive<B> { ... }
fn q_prod(tensor: QuantizedTensor<B>) -> TensorPrimitive<B> { ... }
fn q_prod_dim(tensor: QuantizedTensor<B>, dim: usize) -> TensorPrimitive<B> { ... }
fn q_mean(tensor: QuantizedTensor<B>) -> TensorPrimitive<B> { ... }
fn q_mean_dim(tensor: QuantizedTensor<B>, dim: usize) -> TensorPrimitive<B> { ... }
fn q_cumsum(tensor: QuantizedTensor<B>, dim: usize) -> TensorPrimitive<B> { ... }
fn q_cumprod(tensor: QuantizedTensor<B>, dim: usize) -> TensorPrimitive<B> { ... }
fn q_cummin(tensor: QuantizedTensor<B>, dim: usize) -> TensorPrimitive<B> { ... }
fn q_cummax(tensor: QuantizedTensor<B>, dim: usize) -> TensorPrimitive<B> { ... }
fn q_exp(tensor: QuantizedTensor<B>) -> TensorPrimitive<B> { ... }
fn q_log(tensor: QuantizedTensor<B>) -> TensorPrimitive<B> { ... }
fn q_log1p(tensor: QuantizedTensor<B>) -> TensorPrimitive<B> { ... }
fn q_powf(
lhs: QuantizedTensor<B>,
rhs: QuantizedTensor<B>,
) -> TensorPrimitive<B> { ... }
fn q_powi(lhs: QuantizedTensor<B>, rhs: IntTensor<B>) -> TensorPrimitive<B> { ... }
fn q_powi_scalar(
lhs: QuantizedTensor<B>,
rhs: IntElem<B>,
) -> TensorPrimitive<B> { ... }
fn q_powf_scalar(
tensor: QuantizedTensor<B>,
value: f32,
) -> TensorPrimitive<B> { ... }
fn q_sqrt(tensor: QuantizedTensor<B>) -> TensorPrimitive<B> { ... }
fn q_abs(tensor: QuantizedTensor<B>) -> QuantizedTensor<B> { ... }
fn q_cos(tensor: QuantizedTensor<B>) -> TensorPrimitive<B> { ... }
fn q_sin(tensor: QuantizedTensor<B>) -> TensorPrimitive<B> { ... }
fn q_tan(tensor: QuantizedTensor<B>) -> TensorPrimitive<B> { ... }
fn q_cosh(tensor: QuantizedTensor<B>) -> TensorPrimitive<B> { ... }
fn q_sinh(tensor: QuantizedTensor<B>) -> TensorPrimitive<B> { ... }
fn q_tanh(tensor: QuantizedTensor<B>) -> TensorPrimitive<B> { ... }
fn q_erf(tensor: QuantizedTensor<B>) -> TensorPrimitive<B> { ... }
fn q_cat(tensors: Vec<QuantizedTensor<B>>, dim: usize) -> QuantizedTensor<B> { ... }
fn q_argmax(tensor: QuantizedTensor<B>, dim: usize) -> IntTensor<B> { ... }
fn q_argmin(tensor: QuantizedTensor<B>, dim: usize) -> IntTensor<B> { ... }
fn q_max(tensor: QuantizedTensor<B>) -> QuantizedTensor<B> { ... }
fn q_max_dim(tensor: QuantizedTensor<B>, dim: usize) -> QuantizedTensor<B> { ... }
fn q_max_dim_with_indices(
tensor: QuantizedTensor<B>,
dim: usize,
) -> (QuantizedTensor<B>, IntTensor<B>) { ... }
fn q_min(tensor: QuantizedTensor<B>) -> QuantizedTensor<B> { ... }
fn q_min_dim(tensor: QuantizedTensor<B>, dim: usize) -> QuantizedTensor<B> { ... }
fn q_min_dim_with_indices(
tensor: QuantizedTensor<B>,
dim: usize,
) -> (QuantizedTensor<B>, IntTensor<B>) { ... }
fn q_max_abs(tensor: QuantizedTensor<B>) -> QuantizedTensor<B> { ... }
fn q_max_abs_dim(
tensor: QuantizedTensor<B>,
dim: usize,
) -> QuantizedTensor<B> { ... }
fn q_any(tensor: QuantizedTensor<B>) -> BoolTensor<B> { ... }
fn q_any_dim(tensor: QuantizedTensor<B>, dim: usize) -> BoolTensor<B> { ... }
fn q_all(tensor: QuantizedTensor<B>) -> BoolTensor<B> { ... }
fn q_all_dim(tensor: QuantizedTensor<B>, dim: usize) -> BoolTensor<B> { ... }
fn q_sort(
tensor: QuantizedTensor<B>,
dim: usize,
descending: bool,
) -> QuantizedTensor<B> { ... }
fn q_sort_with_indices(
tensor: QuantizedTensor<B>,
dim: usize,
descending: bool,
) -> (QuantizedTensor<B>, IntTensor<B>) { ... }
fn q_argsort(
tensor: QuantizedTensor<B>,
dim: usize,
descending: bool,
) -> IntTensor<B> { ... }
}Expand description
Operations on quantized tensors.
§Return Type Semantics
The return type of each operation indicates how quantization is handled:
§QuantizedTensor<B>
If the method returns a QuantizedTensor<B>, the operation is expected to preserve the quantized
representation. Implementations should avoid dequantizing when possible to maintain performance.
For example, shape or layout changes such as expand or transpose preserve quantization.
Note: while this currently doesn’t affect the quantized tensor parameters (only per-tensor is supported at the time of writing), other quantization levels (e.g., per-block) may require re-ordering the quantization parameters to match the new layout.
§TensorPrimitive<B>
If the method returns a TensorPrimitive<B> enum, the return type should align with propagation
strategy specified in the quantization scheme. The output should remain quantized (TensorPrimitive::QFloat)
returned in floating-point form (TensorPrimitive::Float).
This distinction allows for fine-grained control over mixed-precision flows while still operating through a unified API.
Required Methods§
Sourcefn q_from_data(data: TensorData, device: &Device<B>) -> QuantizedTensor<B>
fn q_from_data(data: TensorData, device: &Device<B>) -> QuantizedTensor<B>
Sourcefn quantize(
tensor: FloatTensor<B>,
scheme: &QuantScheme,
qparams: QuantizationParametersPrimitive<B>,
) -> QuantizedTensor<B>
fn quantize( tensor: FloatTensor<B>, scheme: &QuantScheme, qparams: QuantizationParametersPrimitive<B>, ) -> QuantizedTensor<B>
Convert the tensor to a lower precision data type based on the quantization scheme and parameters.
Sourcefn dequantize(tensor: QuantizedTensor<B>) -> FloatTensor<B>
fn dequantize(tensor: QuantizedTensor<B>) -> FloatTensor<B>
Convert the tensor back to a higher precision data type.
Sourcefn q_device(tensor: &QuantizedTensor<B>) -> Device<B>
fn q_device(tensor: &QuantizedTensor<B>) -> Device<B>
Sourcefn q_to_device(
tensor: QuantizedTensor<B>,
device: &Device<B>,
) -> QuantizedTensor<B>
fn q_to_device( tensor: QuantizedTensor<B>, device: &Device<B>, ) -> QuantizedTensor<B>
Sourcefn q_reshape(tensor: QuantizedTensor<B>, shape: Shape) -> QuantizedTensor<B>
fn q_reshape(tensor: QuantizedTensor<B>, shape: Shape) -> QuantizedTensor<B>
Sourcefn q_into_data(
tensor: QuantizedTensor<B>,
) -> impl Future<Output = TensorData> + Send
fn q_into_data( tensor: QuantizedTensor<B>, ) -> impl Future<Output = TensorData> + Send
Sourcefn q_expand(tensor: QuantizedTensor<B>, shape: Shape) -> QuantizedTensor<B>
fn q_expand(tensor: QuantizedTensor<B>, shape: Shape) -> QuantizedTensor<B>
Broadcasts the tensor to the given shape.
Sourcefn q_swap_dims(
tensor: QuantizedTensor<B>,
dim1: usize,
dim2: usize,
) -> QuantizedTensor<B>
fn q_swap_dims( tensor: QuantizedTensor<B>, dim1: usize, dim2: usize, ) -> QuantizedTensor<B>
Sourcefn q_permute(tensor: QuantizedTensor<B>, axes: &[usize]) -> QuantizedTensor<B>
fn q_permute(tensor: QuantizedTensor<B>, axes: &[usize]) -> QuantizedTensor<B>
Sourcefn q_flip(tensor: QuantizedTensor<B>, axes: &[usize]) -> QuantizedTensor<B>
fn q_flip(tensor: QuantizedTensor<B>, axes: &[usize]) -> QuantizedTensor<B>
Reverse the order of elements in a tensor along the given axes.
§Arguments
tensor- The tensor to reverse.axes- The axes to reverse.
The tensor with the elements reversed.
Sourcefn q_select(
tensor: QuantizedTensor<B>,
dim: usize,
indices: IntTensor<B>,
) -> QuantizedTensor<B>
fn q_select( tensor: QuantizedTensor<B>, dim: usize, indices: IntTensor<B>, ) -> QuantizedTensor<B>
Sourcefn q_slice(tensor: QuantizedTensor<B>, slices: &[Slice]) -> QuantizedTensor<B>
fn q_slice(tensor: QuantizedTensor<B>, slices: &[Slice]) -> QuantizedTensor<B>
Provided Methods§
Sourcefn quantize_dynamic(
tensor: FloatTensor<B>,
scheme: &QuantScheme,
) -> QuantizedTensor<B>
fn quantize_dynamic( tensor: FloatTensor<B>, scheme: &QuantScheme, ) -> QuantizedTensor<B>
Dynamically convert the tensor to a lower precision data type based on the quantization scheme.
Sourcefn q_detach(tensor: QuantizedTensor<B>) -> QuantizedTensor<B>
fn q_detach(tensor: QuantizedTensor<B>) -> QuantizedTensor<B>
Detaches a tensor from the computation graph.
Sourcefn q_set_require_grad(
tensor: QuantizedTensor<B>,
_require_grad: bool,
) -> QuantizedTensor<B>
fn q_set_require_grad( tensor: QuantizedTensor<B>, _require_grad: bool, ) -> QuantizedTensor<B>
Sets the require_grad flag of a tensor.
Sourcefn q_is_require_grad(_tensor: &QuantizedTensor<B>) -> bool
fn q_is_require_grad(_tensor: &QuantizedTensor<B>) -> bool
Returns the require_grad flag of a tensor.
Sourcefn q_transpose(tensor: QuantizedTensor<B>) -> QuantizedTensor<B>
fn q_transpose(tensor: QuantizedTensor<B>) -> QuantizedTensor<B>
Sourcefn q_gather(
dim: usize,
tensor: QuantizedTensor<B>,
indices: IntTensor<B>,
) -> QuantizedTensor<B>
fn q_gather( dim: usize, tensor: QuantizedTensor<B>, indices: IntTensor<B>, ) -> QuantizedTensor<B>
Sourcefn q_repeat_dim(
tensor: QuantizedTensor<B>,
dim: usize,
times: usize,
) -> QuantizedTensor<B>
fn q_repeat_dim( tensor: QuantizedTensor<B>, dim: usize, times: usize, ) -> QuantizedTensor<B>
Sourcefn q_add(lhs: QuantizedTensor<B>, rhs: QuantizedTensor<B>) -> TensorPrimitive<B>
fn q_add(lhs: QuantizedTensor<B>, rhs: QuantizedTensor<B>) -> TensorPrimitive<B>
Sourcefn q_add_scalar(
lhs: QuantizedTensor<B>,
rhs: FloatElem<B>,
) -> TensorPrimitive<B>
fn q_add_scalar( lhs: QuantizedTensor<B>, rhs: FloatElem<B>, ) -> TensorPrimitive<B>
Sourcefn q_clamp_min(
tensor: QuantizedTensor<B>,
min: FloatElem<B>,
) -> TensorPrimitive<B>
fn q_clamp_min( tensor: QuantizedTensor<B>, min: FloatElem<B>, ) -> TensorPrimitive<B>
Sourcefn q_clamp_max(
tensor: QuantizedTensor<B>,
max: FloatElem<B>,
) -> TensorPrimitive<B>
fn q_clamp_max( tensor: QuantizedTensor<B>, max: FloatElem<B>, ) -> TensorPrimitive<B>
Sourcefn q_clamp(
tensor: QuantizedTensor<B>,
min: FloatElem<B>,
max: FloatElem<B>,
) -> TensorPrimitive<B>
fn q_clamp( tensor: QuantizedTensor<B>, min: FloatElem<B>, max: FloatElem<B>, ) -> TensorPrimitive<B>
Sourcefn q_sub(lhs: QuantizedTensor<B>, rhs: QuantizedTensor<B>) -> TensorPrimitive<B>
fn q_sub(lhs: QuantizedTensor<B>, rhs: QuantizedTensor<B>) -> TensorPrimitive<B>
Sourcefn q_sub_scalar(
lhs: QuantizedTensor<B>,
rhs: FloatElem<B>,
) -> TensorPrimitive<B>
fn q_sub_scalar( lhs: QuantizedTensor<B>, rhs: FloatElem<B>, ) -> TensorPrimitive<B>
Sourcefn q_mul(lhs: QuantizedTensor<B>, rhs: QuantizedTensor<B>) -> TensorPrimitive<B>
fn q_mul(lhs: QuantizedTensor<B>, rhs: QuantizedTensor<B>) -> TensorPrimitive<B>
Multiplies two tensors together element-wise.
Sourcefn q_mul_scalar(
lhs: QuantizedTensor<B>,
rhs: FloatElem<B>,
) -> TensorPrimitive<B>
fn q_mul_scalar( lhs: QuantizedTensor<B>, rhs: FloatElem<B>, ) -> TensorPrimitive<B>
Sourcefn q_div(lhs: QuantizedTensor<B>, rhs: QuantizedTensor<B>) -> TensorPrimitive<B>
fn q_div(lhs: QuantizedTensor<B>, rhs: QuantizedTensor<B>) -> TensorPrimitive<B>
Sourcefn q_div_scalar(
lhs: QuantizedTensor<B>,
rhs: FloatElem<B>,
) -> TensorPrimitive<B>
fn q_div_scalar( lhs: QuantizedTensor<B>, rhs: FloatElem<B>, ) -> TensorPrimitive<B>
Sourcefn q_matmul(
lhs: TensorPrimitive<B>,
rhs: TensorPrimitive<B>,
) -> TensorPrimitive<B>
fn q_matmul( lhs: TensorPrimitive<B>, rhs: TensorPrimitive<B>, ) -> TensorPrimitive<B>
Sourcefn q_neg(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
fn q_neg(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
Negates a tensor element-wise.
Sourcefn q_recip(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
fn q_recip(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
Calculates the reciprocals element-wise
Sourcefn q_sum(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
fn q_sum(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
Sourcefn q_sum_dim(tensor: QuantizedTensor<B>, dim: usize) -> TensorPrimitive<B>
fn q_sum_dim(tensor: QuantizedTensor<B>, dim: usize) -> TensorPrimitive<B>
Sourcefn q_prod(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
fn q_prod(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
Sourcefn q_prod_dim(tensor: QuantizedTensor<B>, dim: usize) -> TensorPrimitive<B>
fn q_prod_dim(tensor: QuantizedTensor<B>, dim: usize) -> TensorPrimitive<B>
Sourcefn q_mean(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
fn q_mean(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
Sourcefn q_mean_dim(tensor: QuantizedTensor<B>, dim: usize) -> TensorPrimitive<B>
fn q_mean_dim(tensor: QuantizedTensor<B>, dim: usize) -> TensorPrimitive<B>
Sourcefn q_cumsum(tensor: QuantizedTensor<B>, dim: usize) -> TensorPrimitive<B>
fn q_cumsum(tensor: QuantizedTensor<B>, dim: usize) -> TensorPrimitive<B>
Computes the cumulative sum of elements along a dimension.
§Arguments
tensor- The tensor to compute the cumulative sum of.dim- The dimension along which to compute the cumulative sum.
§Returns
A tensor with the same shape where each element is the cumulative sum of all elements up to and including that position along the dimension.
Sourcefn q_cumprod(tensor: QuantizedTensor<B>, dim: usize) -> TensorPrimitive<B>
fn q_cumprod(tensor: QuantizedTensor<B>, dim: usize) -> TensorPrimitive<B>
Computes the cumulative product of elements along a dimension.
§Arguments
tensor- The tensor to compute the cumulative product of.dim- The dimension along which to compute the cumulative product.
§Returns
A tensor with the same shape where each element is the cumulative product of all elements up to and including that position along the dimension.
Sourcefn q_cummin(tensor: QuantizedTensor<B>, dim: usize) -> TensorPrimitive<B>
fn q_cummin(tensor: QuantizedTensor<B>, dim: usize) -> TensorPrimitive<B>
Computes the cumulative minimum of elements along a dimension.
§Arguments
tensor- The tensor to compute the cumulative minimum of.dim- The dimension along which to compute the cumulative minimum.
§Returns
A tensor with the same shape where each element is the minimum of all elements up to and including that position along the dimension.
Sourcefn q_cummax(tensor: QuantizedTensor<B>, dim: usize) -> TensorPrimitive<B>
fn q_cummax(tensor: QuantizedTensor<B>, dim: usize) -> TensorPrimitive<B>
Computes the cumulative maximum of elements along a dimension.
§Arguments
tensor- The tensor to compute the cumulative maximum of.dim- The dimension along which to compute the cumulative maximum.
§Returns
A tensor with the same shape where each element is the maximum of all elements up to and including that position along the dimension.
Sourcefn q_exp(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
fn q_exp(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
Sourcefn q_log(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
fn q_log(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
Sourcefn q_log1p(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
fn q_log1p(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
Sourcefn q_powf(
lhs: QuantizedTensor<B>,
rhs: QuantizedTensor<B>,
) -> TensorPrimitive<B>
fn q_powf( lhs: QuantizedTensor<B>, rhs: QuantizedTensor<B>, ) -> TensorPrimitive<B>
Sourcefn q_powi(lhs: QuantizedTensor<B>, rhs: IntTensor<B>) -> TensorPrimitive<B>
fn q_powi(lhs: QuantizedTensor<B>, rhs: IntTensor<B>) -> TensorPrimitive<B>
Sourcefn q_powi_scalar(lhs: QuantizedTensor<B>, rhs: IntElem<B>) -> TensorPrimitive<B>
fn q_powi_scalar(lhs: QuantizedTensor<B>, rhs: IntElem<B>) -> TensorPrimitive<B>
Sourcefn q_powf_scalar(tensor: QuantizedTensor<B>, value: f32) -> TensorPrimitive<B>
fn q_powf_scalar(tensor: QuantizedTensor<B>, value: f32) -> TensorPrimitive<B>
Sourcefn q_sqrt(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
fn q_sqrt(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
Sourcefn q_abs(tensor: QuantizedTensor<B>) -> QuantizedTensor<B>
fn q_abs(tensor: QuantizedTensor<B>) -> QuantizedTensor<B>
Sourcefn q_cos(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
fn q_cos(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
Sourcefn q_sin(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
fn q_sin(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
Sourcefn q_tan(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
fn q_tan(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
Sourcefn q_cosh(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
fn q_cosh(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
Sourcefn q_sinh(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
fn q_sinh(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
Sourcefn q_tanh(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
fn q_tanh(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
Sourcefn q_erf(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
fn q_erf(tensor: QuantizedTensor<B>) -> TensorPrimitive<B>
Sourcefn q_cat(tensors: Vec<QuantizedTensor<B>>, dim: usize) -> QuantizedTensor<B>
fn q_cat(tensors: Vec<QuantizedTensor<B>>, dim: usize) -> QuantizedTensor<B>
Sourcefn q_argmax(tensor: QuantizedTensor<B>, dim: usize) -> IntTensor<B>
fn q_argmax(tensor: QuantizedTensor<B>, dim: usize) -> IntTensor<B>
Sourcefn q_argmin(tensor: QuantizedTensor<B>, dim: usize) -> IntTensor<B>
fn q_argmin(tensor: QuantizedTensor<B>, dim: usize) -> IntTensor<B>
Sourcefn q_max(tensor: QuantizedTensor<B>) -> QuantizedTensor<B>
fn q_max(tensor: QuantizedTensor<B>) -> QuantizedTensor<B>
Sourcefn q_max_dim(tensor: QuantizedTensor<B>, dim: usize) -> QuantizedTensor<B>
fn q_max_dim(tensor: QuantizedTensor<B>, dim: usize) -> QuantizedTensor<B>
Sourcefn q_max_dim_with_indices(
tensor: QuantizedTensor<B>,
dim: usize,
) -> (QuantizedTensor<B>, IntTensor<B>)
fn q_max_dim_with_indices( tensor: QuantizedTensor<B>, dim: usize, ) -> (QuantizedTensor<B>, IntTensor<B>)
Sourcefn q_min(tensor: QuantizedTensor<B>) -> QuantizedTensor<B>
fn q_min(tensor: QuantizedTensor<B>) -> QuantizedTensor<B>
Sourcefn q_min_dim(tensor: QuantizedTensor<B>, dim: usize) -> QuantizedTensor<B>
fn q_min_dim(tensor: QuantizedTensor<B>, dim: usize) -> QuantizedTensor<B>
Sourcefn q_min_dim_with_indices(
tensor: QuantizedTensor<B>,
dim: usize,
) -> (QuantizedTensor<B>, IntTensor<B>)
fn q_min_dim_with_indices( tensor: QuantizedTensor<B>, dim: usize, ) -> (QuantizedTensor<B>, IntTensor<B>)
Sourcefn q_max_abs(tensor: QuantizedTensor<B>) -> QuantizedTensor<B>
fn q_max_abs(tensor: QuantizedTensor<B>) -> QuantizedTensor<B>
Sourcefn q_max_abs_dim(tensor: QuantizedTensor<B>, dim: usize) -> QuantizedTensor<B>
fn q_max_abs_dim(tensor: QuantizedTensor<B>, dim: usize) -> QuantizedTensor<B>
Sourcefn q_any(tensor: QuantizedTensor<B>) -> BoolTensor<B>
fn q_any(tensor: QuantizedTensor<B>) -> BoolTensor<B>
Sourcefn q_any_dim(tensor: QuantizedTensor<B>, dim: usize) -> BoolTensor<B>
fn q_any_dim(tensor: QuantizedTensor<B>, dim: usize) -> BoolTensor<B>
Tests if any element in the float tensor evaluates to True along a given dimension dim.
§Arguments
tensor- The tensor to test.dim- The axis along which to test.
§Returns
A boolean tensor Tensor<B, D, Bool> with the same size as input tensor, except in the dim axis
where the size is 1. The elem in the dim axis is True if any element along this dim in the
input evaluates to True, False otherwise.
Sourcefn q_all(tensor: QuantizedTensor<B>) -> BoolTensor<B>
fn q_all(tensor: QuantizedTensor<B>) -> BoolTensor<B>
Sourcefn q_all_dim(tensor: QuantizedTensor<B>, dim: usize) -> BoolTensor<B>
fn q_all_dim(tensor: QuantizedTensor<B>, dim: usize) -> BoolTensor<B>
Tests if all elements in the tensor evaluate to True along a given dimension dim.
§Arguments
tensor- The tensor to test.dim- The axis along which to test.
§Returns
A boolean tensor Tensor<B, D, Bool> with the same size as input tensor, except in the dim axis
where the size is 1. The elem in the dim axis is True if all elements along this dim in the input
evaluates to True, False otherwise.
Sourcefn q_sort(
tensor: QuantizedTensor<B>,
dim: usize,
descending: bool,
) -> QuantizedTensor<B>
fn q_sort( tensor: QuantizedTensor<B>, dim: usize, descending: bool, ) -> QuantizedTensor<B>
Sort the elements of the input tensor by value in along a given dimension.
This sort is unstable (i.e., may reorder equal elements).
§Arguments
tensor- The input tensor.dim- The axis along which to sort.descending- The sorting order.
§Returns
A tensor with the same shape as the input tensor, where the elements are sorted by value.
Sourcefn q_sort_with_indices(
tensor: QuantizedTensor<B>,
dim: usize,
descending: bool,
) -> (QuantizedTensor<B>, IntTensor<B>)
fn q_sort_with_indices( tensor: QuantizedTensor<B>, dim: usize, descending: bool, ) -> (QuantizedTensor<B>, IntTensor<B>)
Sort the elements of the input tensor by value in along a given dimension.
This sort is unstable (i.e., may reorder equal elements).
§Arguments
tensor- The input tensor.dim- The axis along which to sort.descending- The sorting order.
§Returns
A tensor with the same shape as the input tensor and corresponding indices, where the elements are sorted by value and the indices map back to the original input tensor.
Sourcefn q_argsort(
tensor: QuantizedTensor<B>,
dim: usize,
descending: bool,
) -> IntTensor<B>
fn q_argsort( tensor: QuantizedTensor<B>, dim: usize, descending: bool, ) -> IntTensor<B>
Returns the indices that sort the elements of the input tensor by value along a given dimension.
This sort is unstable (i.e., may reorder equal elements).
§Arguments
tensor- The input tensor.dim- The axis along which to sort.descending- The sorting order.
§Returns
A tensor with the same shape as the input tensor the indices map back to the original input tensor.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.