pub trait FloatTensorOps<B: Backend> {
Show 100 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> + 'static + 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>) -> 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_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>,
ranges: &[Range<usize>],
) -> FloatTensor<B>;
fn float_slice_assign(
tensor: FloatTensor<B>,
ranges: &[Range<usize>],
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_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(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_tanh(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_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>;
// Provided methods
fn float_zeros(shape: Shape, device: &Device<B>) -> FloatTensor<B> { ... }
fn float_ones(shape: Shape, device: &Device<B>) -> FloatTensor<B> { ... }
fn float_full(
shape: Shape,
fill_value: FloatElem<B>,
device: &Device<B>,
) -> 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_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_narrow(
tensor: FloatTensor<B>,
dim: usize,
start: usize,
length: usize,
) -> FloatTensor<B> { ... }
fn float_chunk(
tensor: FloatTensor<B>,
chunks: usize,
dim: usize,
) -> Vec<FloatTensor<B>> ⓘ { ... }
fn float_split(
tensor: FloatTensor<B>,
split_size: usize,
dim: usize,
) -> Vec<FloatTensor<B>> ⓘ { ... }
fn float_split_with_sizes(
tensor: FloatTensor<B>,
split_sizes: Vec<usize>,
dim: usize,
) -> Vec<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> { ... }
}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> + 'static + Send
fn float_into_data( tensor: FloatTensor<B>, ) -> impl Future<Output = TensorData> + 'static + 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>) -> FloatTensor<B>
fn float_empty(shape: Shape, device: &Device<B>) -> 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_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>,
ranges: &[Range<usize>],
) -> FloatTensor<B>
fn float_slice( tensor: FloatTensor<B>, ranges: &[Range<usize>], ) -> FloatTensor<B>
Sourcefn float_slice_assign(
tensor: FloatTensor<B>,
ranges: &[Range<usize>],
value: FloatTensor<B>,
) -> FloatTensor<B>
fn float_slice_assign( tensor: FloatTensor<B>, ranges: &[Range<usize>], 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_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(tensor: FloatTensor<B>, value: f32) -> FloatTensor<B>
fn float_powf_scalar(tensor: FloatTensor<B>, value: f32) -> FloatTensor<B>
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_tanh(tensor: FloatTensor<B>) -> FloatTensor<B>
fn float_tanh(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_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.
Provided Methods§
Sourcefn float_zeros(shape: Shape, device: &Device<B>) -> FloatTensor<B>
fn float_zeros(shape: Shape, device: &Device<B>) -> FloatTensor<B>
Sourcefn float_ones(shape: Shape, device: &Device<B>) -> FloatTensor<B>
fn float_ones(shape: Shape, device: &Device<B>) -> FloatTensor<B>
Sourcefn float_full(
shape: Shape,
fill_value: FloatElem<B>,
device: &Device<B>,
) -> FloatTensor<B>
fn float_full( shape: Shape, fill_value: FloatElem<B>, device: &Device<B>, ) -> 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>
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_narrow(
tensor: FloatTensor<B>,
dim: usize,
start: usize,
length: usize,
) -> FloatTensor<B>
fn float_narrow( tensor: FloatTensor<B>, dim: usize, start: usize, length: usize, ) -> FloatTensor<B>
Returns a new tensor with the given dimension narrowed to the given range.
§Arguments
dim- The dimension along which the tensor will be narrowed.start- The starting point of the given range.length- The ending point of the given range.
§Panics
- If the dimension is greater than the number of dimensions of the tensor.
- If the given range exceeds the number of elements on the given dimension.
§Returns
A new tensor with the given dimension narrowed to the given range.
Sourcefn float_chunk(
tensor: FloatTensor<B>,
chunks: usize,
dim: usize,
) -> Vec<FloatTensor<B>> ⓘ
fn float_chunk( tensor: FloatTensor<B>, chunks: usize, dim: usize, ) -> Vec<FloatTensor<B>> ⓘ
Sourcefn float_split(
tensor: FloatTensor<B>,
split_size: usize,
dim: usize,
) -> Vec<FloatTensor<B>> ⓘ
fn float_split( tensor: FloatTensor<B>, split_size: usize, dim: usize, ) -> Vec<FloatTensor<B>> ⓘ
Sourcefn float_split_with_sizes(
tensor: FloatTensor<B>,
split_sizes: Vec<usize>,
dim: usize,
) -> Vec<FloatTensor<B>> ⓘ
fn float_split_with_sizes( tensor: FloatTensor<B>, split_sizes: Vec<usize>, dim: usize, ) -> Vec<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.
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.