Trait burn::tensor::ops::BoolTensorOps
pub trait BoolTensorOps<B>where
B: Backend,{
Show 29 methods
// Required methods
fn bool_empty<const D: usize>(
shape: Shape<D>,
device: &<B as Backend>::Device,
) -> <B as Backend>::BoolTensorPrimitive<D>;
fn bool_shape<const D: usize>(
tensor: &<B as Backend>::BoolTensorPrimitive<D>,
) -> Shape<D>;
fn bool_into_data<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
) -> impl Future<Output = TensorData> + Send;
fn bool_from_data<const D: usize>(
data: TensorData,
device: &<B as Backend>::Device,
) -> <B as Backend>::BoolTensorPrimitive<D>;
fn bool_into_int<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
) -> <B as Backend>::IntTensorPrimitive<D>;
fn bool_into_float<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
) -> <B as Backend>::FloatTensorPrimitive<D>;
fn bool_device<const D: usize>(
tensor: &<B as Backend>::BoolTensorPrimitive<D>,
) -> <B as Backend>::Device;
fn bool_to_device<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
device: &<B as Backend>::Device,
) -> <B as Backend>::BoolTensorPrimitive<D>;
fn bool_reshape<const D1: usize, const D2: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D1>,
shape: Shape<D2>,
) -> <B as Backend>::BoolTensorPrimitive<D2>;
fn bool_slice<const D1: usize, const D2: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D1>,
ranges: [Range<usize>; D2],
) -> <B as Backend>::BoolTensorPrimitive<D1>;
fn bool_slice_assign<const D1: usize, const D2: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D1>,
ranges: [Range<usize>; D2],
value: <B as Backend>::BoolTensorPrimitive<D1>,
) -> <B as Backend>::BoolTensorPrimitive<D1>;
fn bool_equal<const D: usize>(
lhs: <B as Backend>::BoolTensorPrimitive<D>,
rhs: <B as Backend>::BoolTensorPrimitive<D>,
) -> <B as Backend>::BoolTensorPrimitive<D>;
fn bool_not<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
) -> <B as Backend>::BoolTensorPrimitive<D>;
fn bool_swap_dims<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
dim1: usize,
dim2: usize,
) -> <B as Backend>::BoolTensorPrimitive<D>;
fn bool_permute<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
axes: [usize; D],
) -> <B as Backend>::BoolTensorPrimitive<D>;
fn bool_flip<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
axes: &[usize],
) -> <B as Backend>::BoolTensorPrimitive<D>;
fn bool_expand<const D1: usize, const D2: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D1>,
shape: Shape<D2>,
) -> <B as Backend>::BoolTensorPrimitive<D2>;
// Provided methods
fn bool_repeat_dim<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
dim: usize,
times: usize,
) -> <B as Backend>::BoolTensorPrimitive<D> { ... }
fn bool_cat<const D: usize>(
tensors: Vec<<B as Backend>::BoolTensorPrimitive<D>>,
dim: usize,
) -> <B as Backend>::BoolTensorPrimitive<D> { ... }
fn bool_not_equal<const D: usize>(
lhs: <B as Backend>::BoolTensorPrimitive<D>,
rhs: <B as Backend>::BoolTensorPrimitive<D>,
) -> <B as Backend>::BoolTensorPrimitive<D> { ... }
fn bool_transpose<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
) -> <B as Backend>::BoolTensorPrimitive<D> { ... }
fn bool_narrow<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
dim: usize,
start: usize,
length: usize,
) -> <B as Backend>::BoolTensorPrimitive<D> { ... }
fn bool_chunk<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
chunks: usize,
dim: usize,
) -> Vec<<B as Backend>::BoolTensorPrimitive<D>> { ... }
fn bool_any<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
) -> <B as Backend>::BoolTensorPrimitive<1> { ... }
fn bool_any_dim<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
dim: usize,
) -> <B as Backend>::BoolTensorPrimitive<D> { ... }
fn bool_all<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
) -> <B as Backend>::BoolTensorPrimitive<1> { ... }
fn bool_all_dim<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
dim: usize,
) -> <B as Backend>::BoolTensorPrimitive<D> { ... }
fn bool_argwhere<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
) -> impl Future<Output = <B as Backend>::IntTensorPrimitive<2>> + Send { ... }
fn bool_nonzero<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
) -> impl Future<Output = Vec<<B as Backend>::IntTensorPrimitive<1>>> + Send { ... }
}
Expand description
Bool Tensor API for basic operations, see tensor for documentation on each function.
Required Methods§
fn bool_empty<const D: usize>(
shape: Shape<D>,
device: &<B as Backend>::Device,
) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_empty<const D: usize>( shape: Shape<D>, device: &<B as Backend>::Device, ) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_shape<const D: usize>(
tensor: &<B as Backend>::BoolTensorPrimitive<D>,
) -> Shape<D>
fn bool_shape<const D: usize>( tensor: &<B as Backend>::BoolTensorPrimitive<D>, ) -> Shape<D>
fn bool_into_data<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
) -> impl Future<Output = TensorData> + Send
fn bool_into_data<const D: usize>( tensor: <B as Backend>::BoolTensorPrimitive<D>, ) -> impl Future<Output = TensorData> + Send
fn bool_from_data<const D: usize>(
data: TensorData,
device: &<B as Backend>::Device,
) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_from_data<const D: usize>( data: TensorData, device: &<B as Backend>::Device, ) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_into_int<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
) -> <B as Backend>::IntTensorPrimitive<D>
fn bool_into_int<const D: usize>( tensor: <B as Backend>::BoolTensorPrimitive<D>, ) -> <B as Backend>::IntTensorPrimitive<D>
fn bool_into_float<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
) -> <B as Backend>::FloatTensorPrimitive<D>
fn bool_into_float<const D: usize>( tensor: <B as Backend>::BoolTensorPrimitive<D>, ) -> <B as Backend>::FloatTensorPrimitive<D>
fn bool_device<const D: usize>(
tensor: &<B as Backend>::BoolTensorPrimitive<D>,
) -> <B as Backend>::Device
fn bool_device<const D: usize>( tensor: &<B as Backend>::BoolTensorPrimitive<D>, ) -> <B as Backend>::Device
fn bool_to_device<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
device: &<B as Backend>::Device,
) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_to_device<const D: usize>( tensor: <B as Backend>::BoolTensorPrimitive<D>, device: &<B as Backend>::Device, ) -> <B as Backend>::BoolTensorPrimitive<D>
Moves the tensor to the device.
fn bool_reshape<const D1: usize, const D2: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D1>,
shape: Shape<D2>,
) -> <B as Backend>::BoolTensorPrimitive<D2>
fn bool_reshape<const D1: usize, const D2: usize>( tensor: <B as Backend>::BoolTensorPrimitive<D1>, shape: Shape<D2>, ) -> <B as Backend>::BoolTensorPrimitive<D2>
fn bool_slice<const D1: usize, const D2: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D1>,
ranges: [Range<usize>; D2],
) -> <B as Backend>::BoolTensorPrimitive<D1>
fn bool_slice<const D1: usize, const D2: usize>( tensor: <B as Backend>::BoolTensorPrimitive<D1>, ranges: [Range<usize>; D2], ) -> <B as Backend>::BoolTensorPrimitive<D1>
fn bool_slice_assign<const D1: usize, const D2: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D1>,
ranges: [Range<usize>; D2],
value: <B as Backend>::BoolTensorPrimitive<D1>,
) -> <B as Backend>::BoolTensorPrimitive<D1>
fn bool_slice_assign<const D1: usize, const D2: usize>( tensor: <B as Backend>::BoolTensorPrimitive<D1>, ranges: [Range<usize>; D2], value: <B as Backend>::BoolTensorPrimitive<D1>, ) -> <B as Backend>::BoolTensorPrimitive<D1>
fn bool_equal<const D: usize>(
lhs: <B as Backend>::BoolTensorPrimitive<D>,
rhs: <B as Backend>::BoolTensorPrimitive<D>,
) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_equal<const D: usize>( lhs: <B as Backend>::BoolTensorPrimitive<D>, rhs: <B as Backend>::BoolTensorPrimitive<D>, ) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_not<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_not<const D: usize>( tensor: <B as Backend>::BoolTensorPrimitive<D>, ) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_swap_dims<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
dim1: usize,
dim2: usize,
) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_swap_dims<const D: usize>( tensor: <B as Backend>::BoolTensorPrimitive<D>, dim1: usize, dim2: usize, ) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_permute<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
axes: [usize; D],
) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_permute<const D: usize>( tensor: <B as Backend>::BoolTensorPrimitive<D>, axes: [usize; D], ) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_flip<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
axes: &[usize],
) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_flip<const D: usize>( tensor: <B as Backend>::BoolTensorPrimitive<D>, axes: &[usize], ) -> <B as Backend>::BoolTensorPrimitive<D>
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.
fn bool_expand<const D1: usize, const D2: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D1>,
shape: Shape<D2>,
) -> <B as Backend>::BoolTensorPrimitive<D2>
fn bool_expand<const D1: usize, const D2: usize>( tensor: <B as Backend>::BoolTensorPrimitive<D1>, shape: Shape<D2>, ) -> <B as Backend>::BoolTensorPrimitive<D2>
Broadcasts the bool tensor
to the given shape
.
Provided Methods§
fn bool_repeat_dim<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
dim: usize,
times: usize,
) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_repeat_dim<const D: usize>( tensor: <B as Backend>::BoolTensorPrimitive<D>, dim: usize, times: usize, ) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_cat<const D: usize>(
tensors: Vec<<B as Backend>::BoolTensorPrimitive<D>>,
dim: usize,
) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_cat<const D: usize>( tensors: Vec<<B as Backend>::BoolTensorPrimitive<D>>, dim: usize, ) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_not_equal<const D: usize>(
lhs: <B as Backend>::BoolTensorPrimitive<D>,
rhs: <B as Backend>::BoolTensorPrimitive<D>,
) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_not_equal<const D: usize>( lhs: <B as Backend>::BoolTensorPrimitive<D>, rhs: <B as Backend>::BoolTensorPrimitive<D>, ) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_transpose<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_transpose<const D: usize>( tensor: <B as Backend>::BoolTensorPrimitive<D>, ) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_narrow<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
dim: usize,
start: usize,
length: usize,
) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_narrow<const D: usize>( tensor: <B as Backend>::BoolTensorPrimitive<D>, dim: usize, start: usize, length: usize, ) -> <B as Backend>::BoolTensorPrimitive<D>
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.
fn bool_chunk<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
chunks: usize,
dim: usize,
) -> Vec<<B as Backend>::BoolTensorPrimitive<D>>
fn bool_chunk<const D: usize>( tensor: <B as Backend>::BoolTensorPrimitive<D>, chunks: usize, dim: usize, ) -> Vec<<B as Backend>::BoolTensorPrimitive<D>>
fn bool_any<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
) -> <B as Backend>::BoolTensorPrimitive<1>
fn bool_any<const D: usize>( tensor: <B as Backend>::BoolTensorPrimitive<D>, ) -> <B as Backend>::BoolTensorPrimitive<1>
fn bool_any_dim<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
dim: usize,
) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_any_dim<const D: usize>( tensor: <B as Backend>::BoolTensorPrimitive<D>, dim: usize, ) -> <B as Backend>::BoolTensorPrimitive<D>
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.
fn bool_all<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
) -> <B as Backend>::BoolTensorPrimitive<1>
fn bool_all<const D: usize>( tensor: <B as Backend>::BoolTensorPrimitive<D>, ) -> <B as Backend>::BoolTensorPrimitive<1>
fn bool_all_dim<const D: usize>(
tensor: <B as Backend>::BoolTensorPrimitive<D>,
dim: usize,
) -> <B as Backend>::BoolTensorPrimitive<D>
fn bool_all_dim<const D: usize>( tensor: <B as Backend>::BoolTensorPrimitive<D>, dim: usize, ) -> <B as Backend>::BoolTensorPrimitive<D>
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.