pub trait BoolTensorOps<B>where
B: Backend,{
Show 39 methods
// Required methods
fn bool_empty(
shape: Shape,
device: &<B as Backend>::Device,
) -> <B as Backend>::BoolTensorPrimitive;
fn bool_zeros(
shape: Shape,
device: &<B as Backend>::Device,
) -> <B as Backend>::BoolTensorPrimitive;
fn bool_ones(
shape: Shape,
device: &<B as Backend>::Device,
) -> <B as Backend>::BoolTensorPrimitive;
fn bool_into_data(
tensor: <B as Backend>::BoolTensorPrimitive,
) -> impl Future<Output = Result<TensorData, ExecutionError>> + Send;
fn bool_from_data(
data: TensorData,
device: &<B as Backend>::Device,
) -> <B as Backend>::BoolTensorPrimitive;
fn bool_into_int(
tensor: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::IntTensorPrimitive;
fn bool_into_float(
tensor: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::FloatTensorPrimitive;
fn bool_device(
tensor: &<B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::Device;
fn bool_to_device(
tensor: <B as Backend>::BoolTensorPrimitive,
device: &<B as Backend>::Device,
) -> <B as Backend>::BoolTensorPrimitive;
fn bool_reshape(
tensor: <B as Backend>::BoolTensorPrimitive,
shape: Shape,
) -> <B as Backend>::BoolTensorPrimitive;
fn bool_slice(
tensor: <B as Backend>::BoolTensorPrimitive,
slices: &[Slice],
) -> <B as Backend>::BoolTensorPrimitive;
fn bool_slice_assign(
tensor: <B as Backend>::BoolTensorPrimitive,
slices: &[Slice],
value: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive;
fn bool_mask_where(
tensor: <B as Backend>::BoolTensorPrimitive,
mask: <B as Backend>::BoolTensorPrimitive,
value: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive;
fn bool_mask_fill(
tensor: <B as Backend>::BoolTensorPrimitive,
mask: <B as Backend>::BoolTensorPrimitive,
value: <B as Backend>::BoolElem,
) -> <B as Backend>::BoolTensorPrimitive;
fn bool_gather(
dim: usize,
tensor: <B as Backend>::BoolTensorPrimitive,
indices: <B as Backend>::IntTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive;
fn bool_scatter_or(
dim: usize,
tensor: <B as Backend>::BoolTensorPrimitive,
indices: <B as Backend>::IntTensorPrimitive,
value: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive;
fn bool_equal(
lhs: <B as Backend>::BoolTensorPrimitive,
rhs: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive;
fn bool_equal_elem(
lhs: <B as Backend>::BoolTensorPrimitive,
rhs: <B as Backend>::BoolElem,
) -> <B as Backend>::BoolTensorPrimitive;
fn bool_not(
tensor: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive;
fn bool_and(
tensor: <B as Backend>::BoolTensorPrimitive,
rhs: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive;
fn bool_or(
tensor: <B as Backend>::BoolTensorPrimitive,
rhs: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive;
fn bool_swap_dims(
tensor: <B as Backend>::BoolTensorPrimitive,
dim1: usize,
dim2: usize,
) -> <B as Backend>::BoolTensorPrimitive;
fn bool_permute(
tensor: <B as Backend>::BoolTensorPrimitive,
axes: &[usize],
) -> <B as Backend>::BoolTensorPrimitive;
fn bool_flip(
tensor: <B as Backend>::BoolTensorPrimitive,
axes: &[usize],
) -> <B as Backend>::BoolTensorPrimitive;
fn bool_expand(
tensor: <B as Backend>::BoolTensorPrimitive,
shape: Shape,
) -> <B as Backend>::BoolTensorPrimitive;
fn bool_unfold(
tensor: <B as Backend>::BoolTensorPrimitive,
dim: usize,
size: usize,
step: usize,
) -> <B as Backend>::BoolTensorPrimitive;
// Provided methods
fn bool_select(
tensor: <B as Backend>::BoolTensorPrimitive,
dim: usize,
indices: <B as Backend>::IntTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive { ... }
fn bool_select_or(
tensor: <B as Backend>::BoolTensorPrimitive,
dim: usize,
indices: <B as Backend>::IntTensorPrimitive,
value: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive { ... }
fn bool_repeat_dim(
tensor: <B as Backend>::BoolTensorPrimitive,
dim: usize,
times: usize,
) -> <B as Backend>::BoolTensorPrimitive { ... }
fn bool_cat(
tensors: Vec<<B as Backend>::BoolTensorPrimitive>,
dim: usize,
) -> <B as Backend>::BoolTensorPrimitive { ... }
fn bool_not_equal(
lhs: <B as Backend>::BoolTensorPrimitive,
rhs: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive { ... }
fn bool_not_equal_elem(
lhs: <B as Backend>::BoolTensorPrimitive,
rhs: <B as Backend>::BoolElem,
) -> <B as Backend>::BoolTensorPrimitive { ... }
fn bool_xor(
lhs: <B as Backend>::BoolTensorPrimitive,
rhs: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive { ... }
fn bool_transpose(
tensor: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive { ... }
fn bool_any(
tensor: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive { ... }
fn bool_any_dim(
tensor: <B as Backend>::BoolTensorPrimitive,
dim: usize,
) -> <B as Backend>::BoolTensorPrimitive { ... }
fn bool_all(
tensor: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive { ... }
fn bool_all_dim(
tensor: <B as Backend>::BoolTensorPrimitive,
dim: usize,
) -> <B as Backend>::BoolTensorPrimitive { ... }
fn bool_argwhere(
tensor: <B as Backend>::BoolTensorPrimitive,
) -> impl Future<Output = <B as Backend>::IntTensorPrimitive> + Send + 'static { ... }
}Expand description
Bool Tensor API for basic operations, see
Tensor
for documentation on each function.
Required Methods§
Sourcefn bool_empty(
shape: Shape,
device: &<B as Backend>::Device,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_empty( shape: Shape, device: &<B as Backend>::Device, ) -> <B as Backend>::BoolTensorPrimitive
Sourcefn bool_zeros(
shape: Shape,
device: &<B as Backend>::Device,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_zeros( shape: Shape, device: &<B as Backend>::Device, ) -> <B as Backend>::BoolTensorPrimitive
Sourcefn bool_ones(
shape: Shape,
device: &<B as Backend>::Device,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_ones( shape: Shape, device: &<B as Backend>::Device, ) -> <B as Backend>::BoolTensorPrimitive
Sourcefn bool_into_data(
tensor: <B as Backend>::BoolTensorPrimitive,
) -> impl Future<Output = Result<TensorData, ExecutionError>> + Send
fn bool_into_data( tensor: <B as Backend>::BoolTensorPrimitive, ) -> impl Future<Output = Result<TensorData, ExecutionError>> + Send
Sourcefn bool_from_data(
data: TensorData,
device: &<B as Backend>::Device,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_from_data( data: TensorData, device: &<B as Backend>::Device, ) -> <B as Backend>::BoolTensorPrimitive
Sourcefn bool_into_int(
tensor: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::IntTensorPrimitive
fn bool_into_int( tensor: <B as Backend>::BoolTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive
Sourcefn bool_into_float(
tensor: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::FloatTensorPrimitive
fn bool_into_float( tensor: <B as Backend>::BoolTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive
Sourcefn bool_device(
tensor: &<B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::Device
fn bool_device( tensor: &<B as Backend>::BoolTensorPrimitive, ) -> <B as Backend>::Device
Sourcefn bool_to_device(
tensor: <B as Backend>::BoolTensorPrimitive,
device: &<B as Backend>::Device,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_to_device( tensor: <B as Backend>::BoolTensorPrimitive, device: &<B as Backend>::Device, ) -> <B as Backend>::BoolTensorPrimitive
Moves the tensor to the device.
Sourcefn bool_reshape(
tensor: <B as Backend>::BoolTensorPrimitive,
shape: Shape,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_reshape( tensor: <B as Backend>::BoolTensorPrimitive, shape: Shape, ) -> <B as Backend>::BoolTensorPrimitive
Sourcefn bool_slice(
tensor: <B as Backend>::BoolTensorPrimitive,
slices: &[Slice],
) -> <B as Backend>::BoolTensorPrimitive
fn bool_slice( tensor: <B as Backend>::BoolTensorPrimitive, slices: &[Slice], ) -> <B as Backend>::BoolTensorPrimitive
Gets the values from the tensor for the given ranges.
§Arguments
tensor- The tensor.slices- The slices specifying ranges and steps for each dimension.
§Returns
The tensor with the values for the given slices.
§Note
Empty slices (where start >= end) are handled at the high-level tensor API and will not be passed to this method. Backend implementations do not need to handle empty slices.
Sourcefn bool_slice_assign(
tensor: <B as Backend>::BoolTensorPrimitive,
slices: &[Slice],
value: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_slice_assign( tensor: <B as Backend>::BoolTensorPrimitive, slices: &[Slice], value: <B as Backend>::BoolTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive
Sets the values in the tensor for the given ranges.
§Arguments
tensor- The tensor.ranges- The ranges to set the values for.value- The values to set.
§Returns
The tensor with the values set for the given ranges.
§Note
Empty slice assignments (where any slice range produces 0 elements) are handled at the high-level tensor API and will not be passed to this method. Backend implementations do not need to handle empty slice assignments.
Sourcefn bool_mask_where(
tensor: <B as Backend>::BoolTensorPrimitive,
mask: <B as Backend>::BoolTensorPrimitive,
value: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_mask_where( tensor: <B as Backend>::BoolTensorPrimitive, mask: <B as Backend>::BoolTensorPrimitive, value: <B as Backend>::BoolTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive
Sourcefn bool_mask_fill(
tensor: <B as Backend>::BoolTensorPrimitive,
mask: <B as Backend>::BoolTensorPrimitive,
value: <B as Backend>::BoolElem,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_mask_fill( tensor: <B as Backend>::BoolTensorPrimitive, mask: <B as Backend>::BoolTensorPrimitive, value: <B as Backend>::BoolElem, ) -> <B as Backend>::BoolTensorPrimitive
Sourcefn bool_gather(
dim: usize,
tensor: <B as Backend>::BoolTensorPrimitive,
indices: <B as Backend>::IntTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_gather( dim: usize, tensor: <B as Backend>::BoolTensorPrimitive, indices: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive
Gather elements from the tensor at the given indices.
§Arguments
dim- The dimension to gather from.tensor- The tensor.indices- The indices.
Sourcefn bool_scatter_or(
dim: usize,
tensor: <B as Backend>::BoolTensorPrimitive,
indices: <B as Backend>::IntTensorPrimitive,
value: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_scatter_or( dim: usize, tensor: <B as Backend>::BoolTensorPrimitive, indices: <B as Backend>::IntTensorPrimitive, value: <B as Backend>::BoolTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive
Sourcefn bool_equal(
lhs: <B as Backend>::BoolTensorPrimitive,
rhs: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_equal( lhs: <B as Backend>::BoolTensorPrimitive, rhs: <B as Backend>::BoolTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive
Sourcefn bool_equal_elem(
lhs: <B as Backend>::BoolTensorPrimitive,
rhs: <B as Backend>::BoolElem,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_equal_elem( lhs: <B as Backend>::BoolTensorPrimitive, rhs: <B as Backend>::BoolElem, ) -> <B as Backend>::BoolTensorPrimitive
Sourcefn bool_not(
tensor: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_not( tensor: <B as Backend>::BoolTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive
Sourcefn bool_and(
tensor: <B as Backend>::BoolTensorPrimitive,
rhs: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_and( tensor: <B as Backend>::BoolTensorPrimitive, rhs: <B as Backend>::BoolTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive
Sourcefn bool_or(
tensor: <B as Backend>::BoolTensorPrimitive,
rhs: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_or( tensor: <B as Backend>::BoolTensorPrimitive, rhs: <B as Backend>::BoolTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive
Sourcefn bool_swap_dims(
tensor: <B as Backend>::BoolTensorPrimitive,
dim1: usize,
dim2: usize,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_swap_dims( tensor: <B as Backend>::BoolTensorPrimitive, dim1: usize, dim2: usize, ) -> <B as Backend>::BoolTensorPrimitive
Sourcefn bool_permute(
tensor: <B as Backend>::BoolTensorPrimitive,
axes: &[usize],
) -> <B as Backend>::BoolTensorPrimitive
fn bool_permute( tensor: <B as Backend>::BoolTensorPrimitive, axes: &[usize], ) -> <B as Backend>::BoolTensorPrimitive
Sourcefn bool_flip(
tensor: <B as Backend>::BoolTensorPrimitive,
axes: &[usize],
) -> <B as Backend>::BoolTensorPrimitive
fn bool_flip( tensor: <B as Backend>::BoolTensorPrimitive, axes: &[usize], ) -> <B as Backend>::BoolTensorPrimitive
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: <B as Backend>::BoolTensorPrimitive,
shape: Shape,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_expand( tensor: <B as Backend>::BoolTensorPrimitive, shape: Shape, ) -> <B as Backend>::BoolTensorPrimitive
Broadcasts the bool tensor to the given shape.
Sourcefn bool_unfold(
tensor: <B as Backend>::BoolTensorPrimitive,
dim: usize,
size: usize,
step: usize,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_unfold( tensor: <B as Backend>::BoolTensorPrimitive, dim: usize, size: usize, step: usize, ) -> <B as Backend>::BoolTensorPrimitive
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: <B as Backend>::BoolTensorPrimitive,
dim: usize,
indices: <B as Backend>::IntTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_select( tensor: <B as Backend>::BoolTensorPrimitive, dim: usize, indices: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive
Sourcefn bool_select_or(
tensor: <B as Backend>::BoolTensorPrimitive,
dim: usize,
indices: <B as Backend>::IntTensorPrimitive,
value: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_select_or( tensor: <B as Backend>::BoolTensorPrimitive, dim: usize, indices: <B as Backend>::IntTensorPrimitive, value: <B as Backend>::BoolTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive
Assign the selected elements along the given dimension corresponding to the given indices to the given value using sum reduction.
§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: <B as Backend>::BoolTensorPrimitive,
dim: usize,
times: usize,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_repeat_dim( tensor: <B as Backend>::BoolTensorPrimitive, dim: usize, times: usize, ) -> <B as Backend>::BoolTensorPrimitive
Sourcefn bool_cat(
tensors: Vec<<B as Backend>::BoolTensorPrimitive>,
dim: usize,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_cat( tensors: Vec<<B as Backend>::BoolTensorPrimitive>, dim: usize, ) -> <B as Backend>::BoolTensorPrimitive
Concatenates the tensors along the given dimension.
§Arguments
tensors- The tensors to concatenate.dim- The dimension to concatenate along.
§Returns
The tensor with the tensors concatenated along the given dimension.
§Note
Empty tensors (where the concatenation dimension has size 0) are filtered out at the high-level tensor API and will not be passed to this method. Backend implementations do not need to handle empty tensors.
Sourcefn bool_not_equal(
lhs: <B as Backend>::BoolTensorPrimitive,
rhs: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_not_equal( lhs: <B as Backend>::BoolTensorPrimitive, rhs: <B as Backend>::BoolTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive
Sourcefn bool_not_equal_elem(
lhs: <B as Backend>::BoolTensorPrimitive,
rhs: <B as Backend>::BoolElem,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_not_equal_elem( lhs: <B as Backend>::BoolTensorPrimitive, rhs: <B as Backend>::BoolElem, ) -> <B as Backend>::BoolTensorPrimitive
Sourcefn bool_xor(
lhs: <B as Backend>::BoolTensorPrimitive,
rhs: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_xor( lhs: <B as Backend>::BoolTensorPrimitive, rhs: <B as Backend>::BoolTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive
Sourcefn bool_transpose(
tensor: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_transpose( tensor: <B as Backend>::BoolTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive
Sourcefn bool_any(
tensor: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_any( tensor: <B as Backend>::BoolTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive
Sourcefn bool_any_dim(
tensor: <B as Backend>::BoolTensorPrimitive,
dim: usize,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_any_dim( tensor: <B as Backend>::BoolTensorPrimitive, dim: usize, ) -> <B as Backend>::BoolTensorPrimitive
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: <B as Backend>::BoolTensorPrimitive,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_all( tensor: <B as Backend>::BoolTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive
Sourcefn bool_all_dim(
tensor: <B as Backend>::BoolTensorPrimitive,
dim: usize,
) -> <B as Backend>::BoolTensorPrimitive
fn bool_all_dim( tensor: <B as Backend>::BoolTensorPrimitive, dim: usize, ) -> <B as Backend>::BoolTensorPrimitive
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: <B as Backend>::BoolTensorPrimitive,
) -> impl Future<Output = <B as Backend>::IntTensorPrimitive> + Send + 'static
fn bool_argwhere( tensor: <B as Backend>::BoolTensorPrimitive, ) -> impl Future<Output = <B as Backend>::IntTensorPrimitive> + Send + 'static
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.