pub trait BoolTensorOps<B: Backend> {
Show 33 methods
// Required methods
fn bool_empty(shape: Shape, device: &Device<B>) -> BoolTensor<B>;
fn bool_zeros(shape: Shape, device: &Device<B>) -> BoolTensor<B>;
fn bool_ones(shape: Shape, device: &Device<B>) -> BoolTensor<B>;
fn bool_into_data(
tensor: BoolTensor<B>,
) -> impl Future<Output = TensorData> + Send;
fn bool_from_data(data: TensorData, device: &Device<B>) -> BoolTensor<B>;
fn bool_into_int(tensor: BoolTensor<B>) -> IntTensor<B>;
fn bool_into_float(tensor: BoolTensor<B>) -> FloatTensor<B>;
fn bool_device(tensor: &BoolTensor<B>) -> Device<B>;
fn bool_to_device(
tensor: BoolTensor<B>,
device: &Device<B>,
) -> BoolTensor<B>;
fn bool_reshape(tensor: BoolTensor<B>, shape: Shape) -> BoolTensor<B>;
fn bool_slice(tensor: BoolTensor<B>, slices: &[Slice]) -> BoolTensor<B>;
fn bool_slice_assign(
tensor: BoolTensor<B>,
slices: &[Slice],
value: BoolTensor<B>,
) -> BoolTensor<B>;
fn bool_equal(lhs: BoolTensor<B>, rhs: BoolTensor<B>) -> BoolTensor<B>;
fn bool_not(tensor: BoolTensor<B>) -> BoolTensor<B>;
fn bool_and(tensor: BoolTensor<B>, rhs: BoolTensor<B>) -> BoolTensor<B>;
fn bool_or(tensor: BoolTensor<B>, rhs: BoolTensor<B>) -> BoolTensor<B>;
fn bool_swap_dims(
tensor: BoolTensor<B>,
dim1: usize,
dim2: usize,
) -> BoolTensor<B>;
fn bool_permute(tensor: BoolTensor<B>, axes: &[usize]) -> BoolTensor<B>;
fn bool_flip(tensor: BoolTensor<B>, axes: &[usize]) -> BoolTensor<B>;
fn bool_expand(tensor: BoolTensor<B>, shape: Shape) -> BoolTensor<B>;
fn bool_unfold(
tensor: BoolTensor<B>,
dim: usize,
size: usize,
step: usize,
) -> BoolTensor<B>;
// Provided methods
fn bool_select(
tensor: BoolTensor<B>,
dim: usize,
indices: IntTensor<B>,
) -> BoolTensor<B> { ... }
fn bool_select_assign(
tensor: BoolTensor<B>,
dim: usize,
indices: IntTensor<B>,
value: BoolTensor<B>,
) -> BoolTensor<B> { ... }
fn bool_repeat_dim(
tensor: BoolTensor<B>,
dim: usize,
times: usize,
) -> BoolTensor<B> { ... }
fn bool_cat(tensors: Vec<BoolTensor<B>>, dim: usize) -> BoolTensor<B> { ... }
fn bool_not_equal(lhs: BoolTensor<B>, rhs: BoolTensor<B>) -> BoolTensor<B> { ... }
fn bool_xor(lhs: BoolTensor<B>, rhs: BoolTensor<B>) -> BoolTensor<B> { ... }
fn bool_transpose(tensor: BoolTensor<B>) -> BoolTensor<B> { ... }
fn bool_any(tensor: BoolTensor<B>) -> BoolTensor<B> { ... }
fn bool_any_dim(tensor: BoolTensor<B>, dim: usize) -> BoolTensor<B> { ... }
fn bool_all(tensor: BoolTensor<B>) -> BoolTensor<B> { ... }
fn bool_all_dim(tensor: BoolTensor<B>, dim: usize) -> BoolTensor<B> { ... }
fn bool_argwhere(
tensor: BoolTensor<B>,
) -> impl Future<Output = IntTensor<B>> + 'static + Send { ... }
}Expand description
Bool Tensor API for basic operations, see tensor for documentation on each function.
Required Methods§
Sourcefn bool_empty(shape: Shape, device: &Device<B>) -> BoolTensor<B>
fn bool_empty(shape: Shape, device: &Device<B>) -> BoolTensor<B>
Sourcefn bool_zeros(shape: Shape, device: &Device<B>) -> BoolTensor<B>
fn bool_zeros(shape: Shape, device: &Device<B>) -> BoolTensor<B>
Sourcefn bool_ones(shape: Shape, device: &Device<B>) -> BoolTensor<B>
fn bool_ones(shape: Shape, device: &Device<B>) -> BoolTensor<B>
Sourcefn bool_into_data(
tensor: BoolTensor<B>,
) -> impl Future<Output = TensorData> + Send
fn bool_into_data( tensor: BoolTensor<B>, ) -> impl Future<Output = TensorData> + Send
Sourcefn bool_from_data(data: TensorData, device: &Device<B>) -> BoolTensor<B>
fn bool_from_data(data: TensorData, device: &Device<B>) -> BoolTensor<B>
Sourcefn bool_into_int(tensor: BoolTensor<B>) -> IntTensor<B>
fn bool_into_int(tensor: BoolTensor<B>) -> IntTensor<B>
Sourcefn bool_into_float(tensor: BoolTensor<B>) -> FloatTensor<B>
fn bool_into_float(tensor: BoolTensor<B>) -> FloatTensor<B>
Sourcefn bool_device(tensor: &BoolTensor<B>) -> Device<B>
fn bool_device(tensor: &BoolTensor<B>) -> Device<B>
Sourcefn bool_to_device(tensor: BoolTensor<B>, device: &Device<B>) -> BoolTensor<B>
fn bool_to_device(tensor: BoolTensor<B>, device: &Device<B>) -> BoolTensor<B>
Moves the tensor to the device.
Sourcefn bool_reshape(tensor: BoolTensor<B>, shape: Shape) -> BoolTensor<B>
fn bool_reshape(tensor: BoolTensor<B>, shape: Shape) -> BoolTensor<B>
Sourcefn bool_slice(tensor: BoolTensor<B>, slices: &[Slice]) -> BoolTensor<B>
fn bool_slice(tensor: BoolTensor<B>, slices: &[Slice]) -> BoolTensor<B>
Sourcefn bool_slice_assign(
tensor: BoolTensor<B>,
slices: &[Slice],
value: BoolTensor<B>,
) -> BoolTensor<B>
fn bool_slice_assign( tensor: BoolTensor<B>, slices: &[Slice], value: BoolTensor<B>, ) -> BoolTensor<B>
Sourcefn bool_equal(lhs: BoolTensor<B>, rhs: BoolTensor<B>) -> BoolTensor<B>
fn bool_equal(lhs: BoolTensor<B>, rhs: BoolTensor<B>) -> BoolTensor<B>
Sourcefn bool_not(tensor: BoolTensor<B>) -> BoolTensor<B>
fn bool_not(tensor: BoolTensor<B>) -> BoolTensor<B>
Sourcefn bool_and(tensor: BoolTensor<B>, rhs: BoolTensor<B>) -> BoolTensor<B>
fn bool_and(tensor: BoolTensor<B>, rhs: BoolTensor<B>) -> BoolTensor<B>
Sourcefn bool_or(tensor: BoolTensor<B>, rhs: BoolTensor<B>) -> BoolTensor<B>
fn bool_or(tensor: BoolTensor<B>, rhs: BoolTensor<B>) -> BoolTensor<B>
Sourcefn bool_swap_dims(
tensor: BoolTensor<B>,
dim1: usize,
dim2: usize,
) -> BoolTensor<B>
fn bool_swap_dims( tensor: BoolTensor<B>, dim1: usize, dim2: usize, ) -> BoolTensor<B>
Sourcefn bool_permute(tensor: BoolTensor<B>, axes: &[usize]) -> BoolTensor<B>
fn bool_permute(tensor: BoolTensor<B>, axes: &[usize]) -> BoolTensor<B>
Sourcefn bool_flip(tensor: BoolTensor<B>, axes: &[usize]) -> BoolTensor<B>
fn bool_flip(tensor: BoolTensor<B>, axes: &[usize]) -> BoolTensor<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 bool_expand(tensor: BoolTensor<B>, shape: Shape) -> BoolTensor<B>
fn bool_expand(tensor: BoolTensor<B>, shape: Shape) -> BoolTensor<B>
Broadcasts the bool tensor to the given shape.
Sourcefn bool_unfold(
tensor: BoolTensor<B>,
dim: usize,
size: usize,
step: usize,
) -> BoolTensor<B>
fn bool_unfold( tensor: BoolTensor<B>, dim: usize, size: usize, step: usize, ) -> BoolTensor<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 bool_select(
tensor: BoolTensor<B>,
dim: usize,
indices: IntTensor<B>,
) -> BoolTensor<B>
fn bool_select( tensor: BoolTensor<B>, dim: usize, indices: IntTensor<B>, ) -> BoolTensor<B>
Sourcefn bool_select_assign(
tensor: BoolTensor<B>,
dim: usize,
indices: IntTensor<B>,
value: BoolTensor<B>,
) -> BoolTensor<B>
fn bool_select_assign( tensor: BoolTensor<B>, dim: usize, indices: IntTensor<B>, value: BoolTensor<B>, ) -> BoolTensor<B>
Assign the selected elements along the given dimension corresponding to the given indices to the given value.
§Arguments
tensor- The tensor to assign the values to.dim- The dimension to select from.indices- The indices of the elements to assign.value- The values to assign.
§Returns
The tensor with the assigned values.
Sourcefn bool_repeat_dim(
tensor: BoolTensor<B>,
dim: usize,
times: usize,
) -> BoolTensor<B>
fn bool_repeat_dim( tensor: BoolTensor<B>, dim: usize, times: usize, ) -> BoolTensor<B>
Sourcefn bool_cat(tensors: Vec<BoolTensor<B>>, dim: usize) -> BoolTensor<B>
fn bool_cat(tensors: Vec<BoolTensor<B>>, dim: usize) -> BoolTensor<B>
Sourcefn bool_not_equal(lhs: BoolTensor<B>, rhs: BoolTensor<B>) -> BoolTensor<B>
fn bool_not_equal(lhs: BoolTensor<B>, rhs: BoolTensor<B>) -> BoolTensor<B>
Sourcefn bool_xor(lhs: BoolTensor<B>, rhs: BoolTensor<B>) -> BoolTensor<B>
fn bool_xor(lhs: BoolTensor<B>, rhs: BoolTensor<B>) -> BoolTensor<B>
Sourcefn bool_transpose(tensor: BoolTensor<B>) -> BoolTensor<B>
fn bool_transpose(tensor: BoolTensor<B>) -> BoolTensor<B>
Sourcefn bool_any(tensor: BoolTensor<B>) -> BoolTensor<B>
fn bool_any(tensor: BoolTensor<B>) -> BoolTensor<B>
Sourcefn bool_any_dim(tensor: BoolTensor<B>, dim: usize) -> BoolTensor<B>
fn bool_any_dim(tensor: BoolTensor<B>, dim: usize) -> BoolTensor<B>
Tests if any element in the boolean 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 bool_all(tensor: BoolTensor<B>) -> BoolTensor<B>
fn bool_all(tensor: BoolTensor<B>) -> BoolTensor<B>
Sourcefn bool_all_dim(tensor: BoolTensor<B>, dim: usize) -> BoolTensor<B>
fn bool_all_dim(tensor: BoolTensor<B>, dim: usize) -> BoolTensor<B>
Tests if all elements in the boolean 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 bool_argwhere(
tensor: BoolTensor<B>,
) -> impl Future<Output = IntTensor<B>> + 'static + Send
fn bool_argwhere( tensor: BoolTensor<B>, ) -> impl Future<Output = IntTensor<B>> + 'static + Send
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.