pub trait FloatTensorOps<B: Backend> {
Show 113 methods
// Required methods
fn float_from_data(data: TensorData, device: &Device<B>) -> FloatTensor<B>;
fn float_random(
shape: Shape,
distribution: Distribution,
device: &Device<B>,
) -> FloatTensor<B>;
fn float_into_data(
tensor: FloatTensor<B>,
) -> impl Future<Output = TensorData> + Send;
fn float_device(tensor: &FloatTensor<B>) -> Device<B>;
fn float_to_device(
tensor: FloatTensor<B>,
device: &Device<B>,
) -> FloatTensor<B>;
fn float_into_int(tensor: FloatTensor<B>) -> IntTensor<B>;
fn float_empty(
shape: Shape,
device: &Device<B>,
dtype: FloatDType,
) -> FloatTensor<B>;
fn float_add(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> FloatTensor<B>;
fn float_add_scalar(
lhs: FloatTensor<B>,
rhs: FloatElem<B>,
) -> FloatTensor<B>;
fn float_sub(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> FloatTensor<B>;
fn float_sub_scalar(
lhs: FloatTensor<B>,
rhs: FloatElem<B>,
) -> FloatTensor<B>;
fn float_mul(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> FloatTensor<B>;
fn float_mul_scalar(
lhs: FloatTensor<B>,
rhs: FloatElem<B>,
) -> FloatTensor<B>;
fn float_div(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> FloatTensor<B>;
fn float_div_scalar(
lhs: FloatTensor<B>,
rhs: FloatElem<B>,
) -> FloatTensor<B>;
fn float_remainder(
lhs: FloatTensor<B>,
rhs: FloatTensor<B>,
) -> FloatTensor<B>;
fn float_remainder_scalar(
lhs: FloatTensor<B>,
rhs: FloatElem<B>,
) -> FloatTensor<B>;
fn float_matmul(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> FloatTensor<B>;
fn float_cross(
lhs: FloatTensor<B>,
rhs: FloatTensor<B>,
dim: usize,
) -> FloatTensor<B>;
fn float_recip(tensor: FloatTensor<B>) -> FloatTensor<B>;
fn float_swap_dims(
tensor: FloatTensor<B>,
dim1: usize,
dim2: usize,
) -> FloatTensor<B>;
fn float_permute(tensor: FloatTensor<B>, axes: &[usize]) -> FloatTensor<B>;
fn float_flip(tensor: FloatTensor<B>, axes: &[usize]) -> FloatTensor<B>;
fn float_reshape(tensor: FloatTensor<B>, shape: Shape) -> FloatTensor<B>;
fn float_gather(
dim: usize,
tensor: FloatTensor<B>,
indices: IntTensor<B>,
) -> FloatTensor<B>;
fn float_scatter(
dim: usize,
tensor: FloatTensor<B>,
indices: IntTensor<B>,
value: FloatTensor<B>,
) -> FloatTensor<B>;
fn float_select(
tensor: FloatTensor<B>,
dim: usize,
indices: IntTensor<B>,
) -> FloatTensor<B>;
fn float_select_assign(
tensor: FloatTensor<B>,
dim: usize,
indices: IntTensor<B>,
value: FloatTensor<B>,
) -> FloatTensor<B>;
fn float_slice(tensor: FloatTensor<B>, slices: &[Slice]) -> FloatTensor<B>;
fn float_slice_assign(
tensor: FloatTensor<B>,
slices: &[Slice],
value: FloatTensor<B>,
) -> FloatTensor<B>;
fn float_mask_where(
tensor: FloatTensor<B>,
mask: BoolTensor<B>,
value: FloatTensor<B>,
) -> FloatTensor<B>;
fn float_mask_fill(
tensor: FloatTensor<B>,
mask: BoolTensor<B>,
value: FloatElem<B>,
) -> FloatTensor<B>;
fn float_equal(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> BoolTensor<B>;
fn float_equal_elem(lhs: FloatTensor<B>, rhs: FloatElem<B>) -> BoolTensor<B>;
fn float_greater(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> BoolTensor<B>;
fn float_greater_elem(
lhs: FloatTensor<B>,
rhs: FloatElem<B>,
) -> BoolTensor<B>;
fn float_greater_equal(
lhs: FloatTensor<B>,
rhs: FloatTensor<B>,
) -> BoolTensor<B>;
fn float_greater_equal_elem(
lhs: FloatTensor<B>,
rhs: FloatElem<B>,
) -> BoolTensor<B>;
fn float_lower(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> BoolTensor<B>;
fn float_lower_elem(lhs: FloatTensor<B>, rhs: FloatElem<B>) -> BoolTensor<B>;
fn float_lower_equal(
lhs: FloatTensor<B>,
rhs: FloatTensor<B>,
) -> BoolTensor<B>;
fn float_lower_equal_elem(
lhs: FloatTensor<B>,
rhs: FloatElem<B>,
) -> BoolTensor<B>;
fn float_sum(tensor: FloatTensor<B>) -> FloatTensor<B>;
fn float_sum_dim(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B>;
fn float_mean_dim(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B>;
fn float_cumsum(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B>;
fn float_cumprod(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B>;
fn float_cummin(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B>;
fn float_cummax(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B>;
fn float_cast(tensor: FloatTensor<B>, dtype: FloatDType) -> FloatTensor<B>;
fn float_exp(tensor: FloatTensor<B>) -> FloatTensor<B>;
fn float_log(tensor: FloatTensor<B>) -> FloatTensor<B>;
fn float_log1p(tensor: FloatTensor<B>) -> FloatTensor<B>;
fn float_powf(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> FloatTensor<B>;
fn float_powf_scalar_impl(
tensor: FloatTensor<B>,
value: f32,
) -> FloatTensor<B>;
fn float_sqrt(tensor: FloatTensor<B>) -> FloatTensor<B>;
fn float_abs(tensor: FloatTensor<B>) -> FloatTensor<B>;
fn float_cos(tensor: FloatTensor<B>) -> FloatTensor<B>;
fn float_sin(tensor: FloatTensor<B>) -> FloatTensor<B>;
fn float_round(tensor: FloatTensor<B>) -> FloatTensor<B>;
fn float_floor(tensor: FloatTensor<B>) -> FloatTensor<B>;
fn float_ceil(tensor: FloatTensor<B>) -> FloatTensor<B>;
fn float_trunc(tensor: FloatTensor<B>) -> FloatTensor<B>;
fn float_erf(tensor: FloatTensor<B>) -> FloatTensor<B>;
fn float_argmax(tensor: FloatTensor<B>, dim: usize) -> IntTensor<B>;
fn float_argmin(tensor: FloatTensor<B>, dim: usize) -> IntTensor<B>;
fn float_expand(tensor: FloatTensor<B>, shape: Shape) -> FloatTensor<B>;
fn float_unfold(
tensor: FloatTensor<B>,
dim: usize,
size: usize,
step: usize,
) -> FloatTensor<B>;
// Provided methods
fn float_zeros(
shape: Shape,
device: &Device<B>,
dtype: FloatDType,
) -> FloatTensor<B> { ... }
fn float_ones(
shape: Shape,
device: &Device<B>,
dtype: FloatDType,
) -> FloatTensor<B> { ... }
fn float_full(
shape: Shape,
fill_value: FloatElem<B>,
device: &Device<B>,
dtype: FloatDType,
) -> FloatTensor<B> { ... }
fn float_repeat_dim(
tensor: FloatTensor<B>,
dim: usize,
times: usize,
) -> FloatTensor<B> { ... }
fn float_clamp_min(
tensor: FloatTensor<B>,
min: FloatElem<B>,
) -> FloatTensor<B> { ... }
fn float_clamp_max(
tensor: FloatTensor<B>,
max: FloatElem<B>,
) -> FloatTensor<B> { ... }
fn float_clamp(
tensor: FloatTensor<B>,
min: FloatElem<B>,
max: FloatElem<B>,
) -> FloatTensor<B> { ... }
fn float_neg(tensor: FloatTensor<B>) -> FloatTensor<B> { ... }
fn float_transpose(tensor: FloatTensor<B>) -> FloatTensor<B> { ... }
fn float_not_equal(
lhs: FloatTensor<B>,
rhs: FloatTensor<B>,
) -> BoolTensor<B> { ... }
fn float_not_equal_elem(
lhs: FloatTensor<B>,
rhs: FloatElem<B>,
) -> BoolTensor<B> { ... }
fn float_detach(tensor: FloatTensor<B>) -> FloatTensor<B> { ... }
fn float_set_require_grad(
tensor: FloatTensor<B>,
_require_grad: bool,
) -> FloatTensor<B> { ... }
fn float_is_require_grad(_tensor: &FloatTensor<B>) -> bool { ... }
fn float_prod(tensor: FloatTensor<B>) -> FloatTensor<B> { ... }
fn float_prod_dim(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B> { ... }
fn float_mean(tensor: FloatTensor<B>) -> FloatTensor<B> { ... }
fn float_powi(lhs: FloatTensor<B>, rhs: IntTensor<B>) -> FloatTensor<B> { ... }
fn float_powi_scalar(lhs: FloatTensor<B>, rhs: IntElem<B>) -> FloatTensor<B> { ... }
fn float_powi_scalar_impl(
lhs: FloatTensor<B>,
rhs: IntElem<B>,
) -> FloatTensor<B> { ... }
fn float_powf_scalar(tensor: FloatTensor<B>, value: f32) -> FloatTensor<B> { ... }
fn float_tan(tensor: FloatTensor<B>) -> FloatTensor<B> { ... }
fn float_cosh(tensor: FloatTensor<B>) -> FloatTensor<B> { ... }
fn float_sinh(tensor: FloatTensor<B>) -> FloatTensor<B> { ... }
fn float_tanh(tensor: FloatTensor<B>) -> FloatTensor<B> { ... }
fn float_cat(tensors: Vec<FloatTensor<B>>, dim: usize) -> FloatTensor<B> { ... }
fn float_max(tensor: FloatTensor<B>) -> FloatTensor<B> { ... }
fn float_max_dim(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B> { ... }
fn float_max_dim_with_indices(
tensor: FloatTensor<B>,
dim: usize,
) -> (FloatTensor<B>, IntTensor<B>) { ... }
fn float_min(tensor: FloatTensor<B>) -> FloatTensor<B> { ... }
fn float_min_dim(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B> { ... }
fn float_min_dim_with_indices(
tensor: FloatTensor<B>,
dim: usize,
) -> (FloatTensor<B>, IntTensor<B>) { ... }
fn float_max_abs(tensor: FloatTensor<B>) -> FloatTensor<B> { ... }
fn float_max_abs_dim(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B> { ... }
fn float_any(tensor: FloatTensor<B>) -> BoolTensor<B> { ... }
fn float_any_dim(tensor: FloatTensor<B>, dim: usize) -> BoolTensor<B> { ... }
fn float_all(tensor: FloatTensor<B>) -> BoolTensor<B> { ... }
fn float_all_dim(tensor: FloatTensor<B>, dim: usize) -> BoolTensor<B> { ... }
fn float_sign(tensor: FloatTensor<B>) -> FloatTensor<B> { ... }
fn float_sort(
tensor: FloatTensor<B>,
dim: usize,
descending: bool,
) -> FloatTensor<B> { ... }
fn float_sort_with_indices(
tensor: FloatTensor<B>,
dim: usize,
descending: bool,
) -> (FloatTensor<B>, IntTensor<B>) { ... }
fn float_argsort(
tensor: FloatTensor<B>,
dim: usize,
descending: bool,
) -> IntTensor<B> { ... }
fn float_grid_sample_2d(
tensor: FloatTensor<B>,
grid: FloatTensor<B>,
method: InterpolateMode,
) -> FloatTensor<B> { ... }
fn float_is_nan(tensor: FloatTensor<B>) -> BoolTensor<B> { ... }
fn float_is_inf(tensor: FloatTensor<B>) -> BoolTensor<B> { ... }
}Expand description
Operations on float tensors.
Required Methods§
Sourcefn float_from_data(data: TensorData, device: &Device<B>) -> FloatTensor<B>
fn float_from_data(data: TensorData, device: &Device<B>) -> FloatTensor<B>
Sourcefn float_random(
shape: Shape,
distribution: Distribution,
device: &Device<B>,
) -> FloatTensor<B>
fn float_random( shape: Shape, distribution: Distribution, device: &Device<B>, ) -> FloatTensor<B>
Sourcefn float_into_data(
tensor: FloatTensor<B>,
) -> impl Future<Output = TensorData> + Send
fn float_into_data( tensor: FloatTensor<B>, ) -> impl Future<Output = TensorData> + Send
Sourcefn float_device(tensor: &FloatTensor<B>) -> Device<B>
fn float_device(tensor: &FloatTensor<B>) -> Device<B>
Sourcefn float_to_device(tensor: FloatTensor<B>, device: &Device<B>) -> FloatTensor<B>
fn float_to_device(tensor: FloatTensor<B>, device: &Device<B>) -> FloatTensor<B>
Sourcefn float_into_int(tensor: FloatTensor<B>) -> IntTensor<B>
fn float_into_int(tensor: FloatTensor<B>) -> IntTensor<B>
Sourcefn float_empty(
shape: Shape,
device: &Device<B>,
dtype: FloatDType,
) -> FloatTensor<B>
fn float_empty( shape: Shape, device: &Device<B>, dtype: FloatDType, ) -> FloatTensor<B>
Sourcefn float_add(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> FloatTensor<B>
fn float_add(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_add_scalar(lhs: FloatTensor<B>, rhs: FloatElem<B>) -> FloatTensor<B>
fn float_add_scalar(lhs: FloatTensor<B>, rhs: FloatElem<B>) -> FloatTensor<B>
Sourcefn float_sub(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> FloatTensor<B>
fn float_sub(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_sub_scalar(lhs: FloatTensor<B>, rhs: FloatElem<B>) -> FloatTensor<B>
fn float_sub_scalar(lhs: FloatTensor<B>, rhs: FloatElem<B>) -> FloatTensor<B>
Sourcefn float_mul(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> FloatTensor<B>
fn float_mul(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> FloatTensor<B>
Multiplies two tensors together element-wise.
Sourcefn float_mul_scalar(lhs: FloatTensor<B>, rhs: FloatElem<B>) -> FloatTensor<B>
fn float_mul_scalar(lhs: FloatTensor<B>, rhs: FloatElem<B>) -> FloatTensor<B>
Sourcefn float_div(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> FloatTensor<B>
fn float_div(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_div_scalar(lhs: FloatTensor<B>, rhs: FloatElem<B>) -> FloatTensor<B>
fn float_div_scalar(lhs: FloatTensor<B>, rhs: FloatElem<B>) -> FloatTensor<B>
Sourcefn float_remainder(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> FloatTensor<B>
fn float_remainder(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_remainder_scalar(
lhs: FloatTensor<B>,
rhs: FloatElem<B>,
) -> FloatTensor<B>
fn float_remainder_scalar( lhs: FloatTensor<B>, rhs: FloatElem<B>, ) -> FloatTensor<B>
Sourcefn float_matmul(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> FloatTensor<B>
fn float_matmul(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_cross(
lhs: FloatTensor<B>,
rhs: FloatTensor<B>,
dim: usize,
) -> FloatTensor<B>
fn float_cross( lhs: FloatTensor<B>, rhs: FloatTensor<B>, dim: usize, ) -> FloatTensor<B>
Sourcefn float_recip(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_recip(tensor: FloatTensor<B>) -> FloatTensor<B>
Calculates the reciprocals element-wise
Sourcefn float_swap_dims(
tensor: FloatTensor<B>,
dim1: usize,
dim2: usize,
) -> FloatTensor<B>
fn float_swap_dims( tensor: FloatTensor<B>, dim1: usize, dim2: usize, ) -> FloatTensor<B>
Sourcefn float_permute(tensor: FloatTensor<B>, axes: &[usize]) -> FloatTensor<B>
fn float_permute(tensor: FloatTensor<B>, axes: &[usize]) -> FloatTensor<B>
Sourcefn float_flip(tensor: FloatTensor<B>, axes: &[usize]) -> FloatTensor<B>
fn float_flip(tensor: FloatTensor<B>, axes: &[usize]) -> FloatTensor<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 float_reshape(tensor: FloatTensor<B>, shape: Shape) -> FloatTensor<B>
fn float_reshape(tensor: FloatTensor<B>, shape: Shape) -> FloatTensor<B>
Sourcefn float_gather(
dim: usize,
tensor: FloatTensor<B>,
indices: IntTensor<B>,
) -> FloatTensor<B>
fn float_gather( dim: usize, tensor: FloatTensor<B>, indices: IntTensor<B>, ) -> FloatTensor<B>
Sourcefn float_scatter(
dim: usize,
tensor: FloatTensor<B>,
indices: IntTensor<B>,
value: FloatTensor<B>,
) -> FloatTensor<B>
fn float_scatter( dim: usize, tensor: FloatTensor<B>, indices: IntTensor<B>, value: FloatTensor<B>, ) -> FloatTensor<B>
Sourcefn float_select(
tensor: FloatTensor<B>,
dim: usize,
indices: IntTensor<B>,
) -> FloatTensor<B>
fn float_select( tensor: FloatTensor<B>, dim: usize, indices: IntTensor<B>, ) -> FloatTensor<B>
Sourcefn float_select_assign(
tensor: FloatTensor<B>,
dim: usize,
indices: IntTensor<B>,
value: FloatTensor<B>,
) -> FloatTensor<B>
fn float_select_assign( tensor: FloatTensor<B>, dim: usize, indices: IntTensor<B>, value: FloatTensor<B>, ) -> FloatTensor<B>
Assign the selected elements along the given dimension corresponding for the given indices to the given value.
§Arguments
tensor- The tensor to select from.dim- The dimension to select from.indices- The indices to select.value- The value to assign.
§Returns
The tensor with the selected elements assigned to the given value.
Sourcefn float_slice(tensor: FloatTensor<B>, slices: &[Slice]) -> FloatTensor<B>
fn float_slice(tensor: FloatTensor<B>, slices: &[Slice]) -> FloatTensor<B>
Sourcefn float_slice_assign(
tensor: FloatTensor<B>,
slices: &[Slice],
value: FloatTensor<B>,
) -> FloatTensor<B>
fn float_slice_assign( tensor: FloatTensor<B>, slices: &[Slice], value: FloatTensor<B>, ) -> FloatTensor<B>
Sourcefn float_mask_where(
tensor: FloatTensor<B>,
mask: BoolTensor<B>,
value: FloatTensor<B>,
) -> FloatTensor<B>
fn float_mask_where( tensor: FloatTensor<B>, mask: BoolTensor<B>, value: FloatTensor<B>, ) -> FloatTensor<B>
Update the given tensor with the value tensor where the mask is true.
§Arguments
tensor- The tensor to select from.mask- The boolean mask to select with.value- The value to assign to the selected elements from the value tensor.
§Returns
The tensor with the selected elements assigned to the given value.
Sourcefn float_mask_fill(
tensor: FloatTensor<B>,
mask: BoolTensor<B>,
value: FloatElem<B>,
) -> FloatTensor<B>
fn float_mask_fill( tensor: FloatTensor<B>, mask: BoolTensor<B>, value: FloatElem<B>, ) -> FloatTensor<B>
Sourcefn float_equal(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> BoolTensor<B>
fn float_equal(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> BoolTensor<B>
Sourcefn float_equal_elem(lhs: FloatTensor<B>, rhs: FloatElem<B>) -> BoolTensor<B>
fn float_equal_elem(lhs: FloatTensor<B>, rhs: FloatElem<B>) -> BoolTensor<B>
Sourcefn float_greater(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> BoolTensor<B>
fn float_greater(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> BoolTensor<B>
Sourcefn float_greater_elem(lhs: FloatTensor<B>, rhs: FloatElem<B>) -> BoolTensor<B>
fn float_greater_elem(lhs: FloatTensor<B>, rhs: FloatElem<B>) -> BoolTensor<B>
Sourcefn float_greater_equal(
lhs: FloatTensor<B>,
rhs: FloatTensor<B>,
) -> BoolTensor<B>
fn float_greater_equal( lhs: FloatTensor<B>, rhs: FloatTensor<B>, ) -> BoolTensor<B>
Sourcefn float_greater_equal_elem(
lhs: FloatTensor<B>,
rhs: FloatElem<B>,
) -> BoolTensor<B>
fn float_greater_equal_elem( lhs: FloatTensor<B>, rhs: FloatElem<B>, ) -> BoolTensor<B>
Sourcefn float_lower(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> BoolTensor<B>
fn float_lower(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> BoolTensor<B>
Sourcefn float_lower_elem(lhs: FloatTensor<B>, rhs: FloatElem<B>) -> BoolTensor<B>
fn float_lower_elem(lhs: FloatTensor<B>, rhs: FloatElem<B>) -> BoolTensor<B>
Sourcefn float_lower_equal(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> BoolTensor<B>
fn float_lower_equal(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> BoolTensor<B>
Sourcefn float_lower_equal_elem(
lhs: FloatTensor<B>,
rhs: FloatElem<B>,
) -> BoolTensor<B>
fn float_lower_equal_elem( lhs: FloatTensor<B>, rhs: FloatElem<B>, ) -> BoolTensor<B>
Sourcefn float_sum(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_sum(tensor: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_sum_dim(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B>
fn float_sum_dim(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B>
Sourcefn float_mean_dim(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B>
fn float_mean_dim(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B>
Sourcefn float_cumsum(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B>
fn float_cumsum(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<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 float_cumprod(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B>
fn float_cumprod(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<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 float_cummin(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B>
fn float_cummin(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<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 float_cummax(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B>
fn float_cummax(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<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 float_cast(tensor: FloatTensor<B>, dtype: FloatDType) -> FloatTensor<B>
fn float_cast(tensor: FloatTensor<B>, dtype: FloatDType) -> FloatTensor<B>
Sourcefn float_exp(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_exp(tensor: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_log(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_log(tensor: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_log1p(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_log1p(tensor: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_powf(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> FloatTensor<B>
fn float_powf(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_powf_scalar_impl(tensor: FloatTensor<B>, value: f32) -> FloatTensor<B>
fn float_powf_scalar_impl(tensor: FloatTensor<B>, value: f32) -> FloatTensor<B>
Returns a new tensor with values raised to the power of float value.
§Backend Implementors Note
This is the generic implementation of integer exponentiation
called by Self::float_powf_scalar in the fallback case.
This is the minimal required support a Backend must implement
for exponentiation.
As a general rule, this should not be called directly.
§Arguments
tensor- The tensor to exponentiate.value- The exponent.
§Returns
A tensor with the same shape as tensor with values raised to the power of value.
Sourcefn float_sqrt(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_sqrt(tensor: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_abs(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_abs(tensor: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_cos(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_cos(tensor: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_sin(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_sin(tensor: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_round(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_round(tensor: FloatTensor<B>) -> FloatTensor<B>
Returns a new tensor with rounded values.
This function should implement the round half to even strategy, with halfway cases rounded to the nearest even integer value.
§Arguments
tensor- The tensor to be rounded.
§Returns
A tensor with the same shape as tensor with rounded values.
Sourcefn float_floor(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_floor(tensor: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_ceil(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_ceil(tensor: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_trunc(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_trunc(tensor: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_erf(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_erf(tensor: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_argmax(tensor: FloatTensor<B>, dim: usize) -> IntTensor<B>
fn float_argmax(tensor: FloatTensor<B>, dim: usize) -> IntTensor<B>
Sourcefn float_argmin(tensor: FloatTensor<B>, dim: usize) -> IntTensor<B>
fn float_argmin(tensor: FloatTensor<B>, dim: usize) -> IntTensor<B>
Sourcefn float_expand(tensor: FloatTensor<B>, shape: Shape) -> FloatTensor<B>
fn float_expand(tensor: FloatTensor<B>, shape: Shape) -> FloatTensor<B>
Broadcasts the float tensor to the given shape.
Sourcefn float_unfold(
tensor: FloatTensor<B>,
dim: usize,
size: usize,
step: usize,
) -> FloatTensor<B>
fn float_unfold( tensor: FloatTensor<B>, dim: usize, size: usize, step: usize, ) -> FloatTensor<B>
Unfold windows along a dimension.
Returns a view of the tensor with all complete windows of size size in dimension dim;
where windows are advanced by step at each index.
The number of windows is max(0, (shape[dim] - size).ceil_div(step)).
§Arguments
tensor- The input tensor to unfold; of shape[pre=..., dim shape, post=...]dim- the selected dim.size- the size of each unfolded window.step- the step between each window.
§Returns
A tensor view with shape [pre=..., windows, size, post=...].
Provided Methods§
Sourcefn float_zeros(
shape: Shape,
device: &Device<B>,
dtype: FloatDType,
) -> FloatTensor<B>
fn float_zeros( shape: Shape, device: &Device<B>, dtype: FloatDType, ) -> FloatTensor<B>
Sourcefn float_ones(
shape: Shape,
device: &Device<B>,
dtype: FloatDType,
) -> FloatTensor<B>
fn float_ones( shape: Shape, device: &Device<B>, dtype: FloatDType, ) -> FloatTensor<B>
Sourcefn float_full(
shape: Shape,
fill_value: FloatElem<B>,
device: &Device<B>,
dtype: FloatDType,
) -> FloatTensor<B>
fn float_full( shape: Shape, fill_value: FloatElem<B>, device: &Device<B>, dtype: FloatDType, ) -> FloatTensor<B>
Sourcefn float_repeat_dim(
tensor: FloatTensor<B>,
dim: usize,
times: usize,
) -> FloatTensor<B>
fn float_repeat_dim( tensor: FloatTensor<B>, dim: usize, times: usize, ) -> FloatTensor<B>
Sourcefn float_clamp_min(tensor: FloatTensor<B>, min: FloatElem<B>) -> FloatTensor<B>
fn float_clamp_min(tensor: FloatTensor<B>, min: FloatElem<B>) -> FloatTensor<B>
Sourcefn float_clamp_max(tensor: FloatTensor<B>, max: FloatElem<B>) -> FloatTensor<B>
fn float_clamp_max(tensor: FloatTensor<B>, max: FloatElem<B>) -> FloatTensor<B>
Sourcefn float_clamp(
tensor: FloatTensor<B>,
min: FloatElem<B>,
max: FloatElem<B>,
) -> FloatTensor<B>
fn float_clamp( tensor: FloatTensor<B>, min: FloatElem<B>, max: FloatElem<B>, ) -> FloatTensor<B>
Sourcefn float_neg(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_neg(tensor: FloatTensor<B>) -> FloatTensor<B>
Negates a tensor element-wise.
Sourcefn float_transpose(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_transpose(tensor: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_not_equal(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> BoolTensor<B>
fn float_not_equal(lhs: FloatTensor<B>, rhs: FloatTensor<B>) -> BoolTensor<B>
Sourcefn float_not_equal_elem(lhs: FloatTensor<B>, rhs: FloatElem<B>) -> BoolTensor<B>
fn float_not_equal_elem(lhs: FloatTensor<B>, rhs: FloatElem<B>) -> BoolTensor<B>
Sourcefn float_detach(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_detach(tensor: FloatTensor<B>) -> FloatTensor<B>
Detaches a tensor from the computation graph.
Sourcefn float_set_require_grad(
tensor: FloatTensor<B>,
_require_grad: bool,
) -> FloatTensor<B>
fn float_set_require_grad( tensor: FloatTensor<B>, _require_grad: bool, ) -> FloatTensor<B>
Sets the require_grad flag of a tensor.
Sourcefn float_is_require_grad(_tensor: &FloatTensor<B>) -> bool
fn float_is_require_grad(_tensor: &FloatTensor<B>) -> bool
Returns the require_grad flag of a tensor.
Sourcefn float_prod(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_prod(tensor: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_prod_dim(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B>
fn float_prod_dim(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B>
Sourcefn float_mean(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_mean(tensor: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_powi(lhs: FloatTensor<B>, rhs: IntTensor<B>) -> FloatTensor<B>
fn float_powi(lhs: FloatTensor<B>, rhs: IntTensor<B>) -> FloatTensor<B>
Sourcefn float_powi_scalar(lhs: FloatTensor<B>, rhs: IntElem<B>) -> FloatTensor<B>
fn float_powi_scalar(lhs: FloatTensor<B>, rhs: IntElem<B>) -> FloatTensor<B>
Raises a tensor to the power of an int scalar.
§Backend Implementors Note
A number of common exponent cases can be implemented with operations which are much cheaper than generic exponentiation.
This (Backend impl overridable) operation handles generic optimizations
for several common integer exponent cases; and then dispatches to
the (Backend impl overridable) Self::float_powi_scalar_impl
operation to handle the generic case.
§Arguments
lhs- The left-hand side tensor.rhs- The right-hand side scalar.
§Returns
The elements of lhs raised to the value of rhs.
Sourcefn float_powi_scalar_impl(
lhs: FloatTensor<B>,
rhs: IntElem<B>,
) -> FloatTensor<B>
fn float_powi_scalar_impl( lhs: FloatTensor<B>, rhs: IntElem<B>, ) -> FloatTensor<B>
Raises a tensor to the power of an int scalar.
§Backend Implementors Note
This is the generic implementation of integer exponentiation
called by Self::float_powi_scalar in the fallback case.
As a general rule, this should not be called directly.
§Arguments
lhs- The left-hand side tensor.rhs- The right-hand side scalar.
§Returns
The elements of lhs raised to the value of rhs.
Sourcefn float_powf_scalar(tensor: FloatTensor<B>, value: f32) -> FloatTensor<B>
fn float_powf_scalar(tensor: FloatTensor<B>, value: f32) -> FloatTensor<B>
Returns a new tensor with values raised to the power of float value.
§Backend Implementors Note
This (Backend impl overridable) operation dispatches integer exponentiation
to Self::float_powi_scalar, and the remaining non-integer exponent cases to
the (Backend impl overridable) Self::float_powf_scalar_impl
operation to handle the generic case.
§Arguments
tensor- The tensor to exponentiate.value- The exponent.
§Returns
A tensor with the same shape as tensor with values raised to the power of value.
Sourcefn float_tan(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_tan(tensor: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_cosh(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_cosh(tensor: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_sinh(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_sinh(tensor: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_tanh(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_tanh(tensor: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_cat(tensors: Vec<FloatTensor<B>>, dim: usize) -> FloatTensor<B>
fn float_cat(tensors: Vec<FloatTensor<B>>, dim: usize) -> FloatTensor<B>
Sourcefn float_max(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_max(tensor: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_max_dim(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B>
fn float_max_dim(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B>
Sourcefn float_max_dim_with_indices(
tensor: FloatTensor<B>,
dim: usize,
) -> (FloatTensor<B>, IntTensor<B>)
fn float_max_dim_with_indices( tensor: FloatTensor<B>, dim: usize, ) -> (FloatTensor<B>, IntTensor<B>)
Sourcefn float_min(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_min(tensor: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_min_dim(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B>
fn float_min_dim(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B>
Sourcefn float_min_dim_with_indices(
tensor: FloatTensor<B>,
dim: usize,
) -> (FloatTensor<B>, IntTensor<B>)
fn float_min_dim_with_indices( tensor: FloatTensor<B>, dim: usize, ) -> (FloatTensor<B>, IntTensor<B>)
Sourcefn float_max_abs(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_max_abs(tensor: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_max_abs_dim(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B>
fn float_max_abs_dim(tensor: FloatTensor<B>, dim: usize) -> FloatTensor<B>
Sourcefn float_any(tensor: FloatTensor<B>) -> BoolTensor<B>
fn float_any(tensor: FloatTensor<B>) -> BoolTensor<B>
Sourcefn float_any_dim(tensor: FloatTensor<B>, dim: usize) -> BoolTensor<B>
fn float_any_dim(tensor: FloatTensor<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 float_all(tensor: FloatTensor<B>) -> BoolTensor<B>
fn float_all(tensor: FloatTensor<B>) -> BoolTensor<B>
Sourcefn float_all_dim(tensor: FloatTensor<B>, dim: usize) -> BoolTensor<B>
fn float_all_dim(tensor: FloatTensor<B>, dim: usize) -> BoolTensor<B>
Tests if all elements in the float 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 float_sign(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_sign(tensor: FloatTensor<B>) -> FloatTensor<B>
Sourcefn float_sort(
tensor: FloatTensor<B>,
dim: usize,
descending: bool,
) -> FloatTensor<B>
fn float_sort( tensor: FloatTensor<B>, dim: usize, descending: bool, ) -> FloatTensor<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 float_sort_with_indices(
tensor: FloatTensor<B>,
dim: usize,
descending: bool,
) -> (FloatTensor<B>, IntTensor<B>)
fn float_sort_with_indices( tensor: FloatTensor<B>, dim: usize, descending: bool, ) -> (FloatTensor<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 float_argsort(
tensor: FloatTensor<B>,
dim: usize,
descending: bool,
) -> IntTensor<B>
fn float_argsort( tensor: FloatTensor<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.
Sourcefn float_grid_sample_2d(
tensor: FloatTensor<B>,
grid: FloatTensor<B>,
method: InterpolateMode,
) -> FloatTensor<B>
fn float_grid_sample_2d( tensor: FloatTensor<B>, grid: FloatTensor<B>, method: InterpolateMode, ) -> FloatTensor<B>
Samples tensor as a two-dimensional spatial grid of (possibly multi-channel) values, using the given locations in [-1, 1].
Interpolation is bilinear. Padding is border: out of bounds locations will be clamped to the nearest border
tensor- The tensor being sampled from, shape (N, C, H_in, W_in)grid- A tensor of locations, with shape (N, H_out, W_out, 2). Values are [-1, 1]. A [x = -1, y = -1] means top-left, and [x = 1, y = 1] means bottom-rightmethod- How to interpolate between samples
§Returns
A tensor with shape (N, C, H_out, W_out)
Sourcefn float_is_nan(tensor: FloatTensor<B>) -> BoolTensor<B>
fn float_is_nan(tensor: FloatTensor<B>) -> BoolTensor<B>
Returns a new tensor with boolean elements indicating whether each element of the input is NaN.
§Returns
A boolean tensor where true indicates NaN and false indicates a non-NaN value.
Sourcefn float_is_inf(tensor: FloatTensor<B>) -> BoolTensor<B>
fn float_is_inf(tensor: FloatTensor<B>) -> BoolTensor<B>
Returns a new tensor with boolean elements indicating whether each element of the input is infinite (either +INF or -INF).
§Returns
A boolean tensor where true indicates that the value is infinite
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.