pub struct Int;
Expand description
A type-level representation of the kind of a int tensor.
Trait Implementations§
Source§impl<B: AutodiffBackend> BasicAutodiffOps<B> for Int
impl<B: AutodiffBackend> BasicAutodiffOps<B> for Int
Source§fn inner(
tensor: <Self as TensorKind<B>>::Primitive,
) -> <Self::InnerKind as TensorKind<<B as AutodiffBackend>::InnerBackend>>::Primitive
fn inner( tensor: <Self as TensorKind<B>>::Primitive, ) -> <Self::InnerKind as TensorKind<<B as AutodiffBackend>::InnerBackend>>::Primitive
Returns the inner tensor without the autodiff information. Read more
Source§fn from_inner(
inner: <Self::InnerKind as TensorKind<<B as AutodiffBackend>::InnerBackend>>::Primitive,
) -> <Self as TensorKind<B>>::Primitive
fn from_inner( inner: <Self::InnerKind as TensorKind<<B as AutodiffBackend>::InnerBackend>>::Primitive, ) -> <Self as TensorKind<B>>::Primitive
Convert a tensor to the autodiff backend. Read more
Source§impl<B: Backend> BasicOps<B> for Int
impl<B: Backend> BasicOps<B> for Int
Source§fn empty(shape: Shape, device: &B::Device) -> Self::Primitive
fn empty(shape: Shape, device: &B::Device) -> Self::Primitive
Creates an empty tensor with the given shape. Read more
Source§fn register_transaction(tr: &mut Transaction<B>, tensor: Self::Primitive)
fn register_transaction(tr: &mut Transaction<B>, tensor: Self::Primitive)
Read the data from the tensor using a transaction. Read more
Source§fn reshape(tensor: Self::Primitive, shape: Shape) -> Self::Primitive
fn reshape(tensor: Self::Primitive, shape: Shape) -> Self::Primitive
Reshapes the tensor. Read more
Source§fn swap_dims(
tensor: Self::Primitive,
dim1: usize,
dim2: usize,
) -> Self::Primitive
fn swap_dims( tensor: Self::Primitive, dim1: usize, dim2: usize, ) -> Self::Primitive
Swaps two dimensions of a tensor. Read more
Source§fn slice(tensor: Self::Primitive, ranges: &[Range<usize>]) -> Self::Primitive
fn slice(tensor: Self::Primitive, ranges: &[Range<usize>]) -> Self::Primitive
Select tensor elements corresponding for the given ranges. Read more
Source§fn slice_assign(
tensor: Self::Primitive,
ranges: &[Range<usize>],
value: Self::Primitive,
) -> Self::Primitive
fn slice_assign( tensor: Self::Primitive, ranges: &[Range<usize>], value: Self::Primitive, ) -> Self::Primitive
Assigns the given value to the tensor elements corresponding for the given ranges. Read more
Source§fn device(tensor: &Self::Primitive) -> Device<B>
fn device(tensor: &Self::Primitive) -> Device<B>
Returns the device on which the tensor is allocated. Read more
Source§fn to_device(tensor: Self::Primitive, device: &Device<B>) -> Self::Primitive
fn to_device(tensor: Self::Primitive, device: &Device<B>) -> Self::Primitive
Moves the tensor to the given device. Read more
Source§async fn into_data_async(tensor: Self::Primitive) -> TensorData
async fn into_data_async(tensor: Self::Primitive) -> TensorData
Extracts the data from the tensor asynchronously. Read more
Source§fn from_data(data: TensorData, device: &B::Device) -> Self::Primitive
fn from_data(data: TensorData, device: &B::Device) -> Self::Primitive
Creates a tensor from the given data. Read more
Source§fn from_data_dtype(
data: TensorData,
device: &B::Device,
dtype: DType,
) -> Self::Primitive
fn from_data_dtype( data: TensorData, device: &B::Device, dtype: DType, ) -> Self::Primitive
Creates a tensor from the given data enforcing the given data type. Read more
Source§fn repeat_dim(
tensor: Self::Primitive,
dim: usize,
times: usize,
) -> Self::Primitive
fn repeat_dim( tensor: Self::Primitive, dim: usize, times: usize, ) -> Self::Primitive
Repeat the tensor along the given dimension. Read more
Source§fn equal(lhs: Self::Primitive, rhs: Self::Primitive) -> B::BoolTensorPrimitive
fn equal(lhs: Self::Primitive, rhs: Self::Primitive) -> B::BoolTensorPrimitive
Equates the given tensors. Read more
Source§fn not_equal(
lhs: Self::Primitive,
rhs: Self::Primitive,
) -> B::BoolTensorPrimitive
fn not_equal( lhs: Self::Primitive, rhs: Self::Primitive, ) -> B::BoolTensorPrimitive
Applies element-wise non-equality comparison between the given tensors. Read more
Source§fn cat(vectors: Vec<Self::Primitive>, dim: usize) -> Self::Primitive
fn cat(vectors: Vec<Self::Primitive>, dim: usize) -> Self::Primitive
Concatenates the given tensors along the given dimension. Read more
Source§fn any(tensor: Self::Primitive) -> B::BoolTensorPrimitive
fn any(tensor: Self::Primitive) -> B::BoolTensorPrimitive
Tests if any element in the
tensor
evaluates to True. Read moreSource§fn any_dim(tensor: Self::Primitive, dim: usize) -> B::BoolTensorPrimitive
fn any_dim(tensor: Self::Primitive, dim: usize) -> B::BoolTensorPrimitive
Tests if any element in the tensor evaluates to True along a given dimension dim. Read more
Source§fn all(tensor: Self::Primitive) -> B::BoolTensorPrimitive
fn all(tensor: Self::Primitive) -> B::BoolTensorPrimitive
Tests if all elements in the
tensor
evaluate to True. Read moreSource§fn permute(tensor: Self::Primitive, axes: &[usize]) -> Self::Primitive
fn permute(tensor: Self::Primitive, axes: &[usize]) -> Self::Primitive
Permutes the dimensions of a tensor. Read more
Source§fn expand(tensor: Self::Primitive, shape: Shape) -> Self::Primitive
fn expand(tensor: Self::Primitive, shape: Shape) -> Self::Primitive
Broadcasts the given tensor to the specified shape. Read more
Source§fn flip(tensor: Self::Primitive, axes: &[usize]) -> Self::Primitive
fn flip(tensor: Self::Primitive, axes: &[usize]) -> Self::Primitive
Flips the tensor along the given axes. Read more
Source§fn chunk(
tensor: Self::Primitive,
chunks: usize,
dim: usize,
) -> Vec<Self::Primitive>
fn chunk( tensor: Self::Primitive, chunks: usize, dim: usize, ) -> Vec<Self::Primitive>
Attempts to split the tensor along the given dimension into chunks.
May return less chunks than requested if the tensor size is not divisible by the number of chunks. Read more
Source§fn split(
tensor: Self::Primitive,
split_size: usize,
dim: usize,
) -> Vec<Self::Primitive>
fn split( tensor: Self::Primitive, split_size: usize, dim: usize, ) -> Vec<Self::Primitive>
Splits the tensor into chunks of a specified size along a given dimension.
Each chunk is a view of the original tensor. Read more
Source§fn split_with_sizes(
tensor: Self::Primitive,
split_sizes: Vec<usize>,
dim: usize,
) -> Vec<Self::Primitive>
fn split_with_sizes( tensor: Self::Primitive, split_sizes: Vec<usize>, dim: usize, ) -> Vec<Self::Primitive>
Splits the tensor into chunks with the specified sizes along a given dimension.
Each chunk is a view of the original tensor. Read more
Source§fn elem_type_name() -> &'static str
fn elem_type_name() -> &'static str
Returns the name of the element type.
Source§impl<B: Backend> Numeric<B> for Int
impl<B: Backend> Numeric<B> for Int
Source§fn add(
lhs: Self::Primitive,
rhs: Self::Primitive,
) -> <Int as TensorKind<B>>::Primitive
fn add( lhs: Self::Primitive, rhs: Self::Primitive, ) -> <Int as TensorKind<B>>::Primitive
Adds two tensors together. Read more
Source§fn add_scalar<E: ElementConversion>(
lhs: Self::Primitive,
rhs: E,
) -> Self::Primitive
fn add_scalar<E: ElementConversion>( lhs: Self::Primitive, rhs: E, ) -> Self::Primitive
Adds a scalar to a tensor element-wise. Read more
Source§fn sub(
lhs: Self::Primitive,
rhs: Self::Primitive,
) -> <Int as TensorKind<B>>::Primitive
fn sub( lhs: Self::Primitive, rhs: Self::Primitive, ) -> <Int as TensorKind<B>>::Primitive
Subtracts two tensors. Read more
Source§fn sub_scalar<E: ElementConversion>(
lhs: Self::Primitive,
rhs: E,
) -> Self::Primitive
fn sub_scalar<E: ElementConversion>( lhs: Self::Primitive, rhs: E, ) -> Self::Primitive
Subtracts a scalar from a tensor element-wise. Read more
Source§fn div(
lhs: Self::Primitive,
rhs: Self::Primitive,
) -> <Int as TensorKind<B>>::Primitive
fn div( lhs: Self::Primitive, rhs: Self::Primitive, ) -> <Int as TensorKind<B>>::Primitive
Divides two tensors. Read more
Source§fn div_scalar<E: ElementConversion>(
lhs: Self::Primitive,
rhs: E,
) -> Self::Primitive
fn div_scalar<E: ElementConversion>( lhs: Self::Primitive, rhs: E, ) -> Self::Primitive
Divides a tensor by a scalar element-wise. Read more
Source§fn remainder(lhs: Self::Primitive, rhs: Self::Primitive) -> Self::Primitive
fn remainder(lhs: Self::Primitive, rhs: Self::Primitive) -> Self::Primitive
Computes the modulo element-wise. The result is the signed remainder of the division and its absolute value is
less than that of the divisor. Read more
Source§fn remainder_scalar<E: ElementConversion>(
lhs: Self::Primitive,
rhs: E,
) -> Self::Primitive
fn remainder_scalar<E: ElementConversion>( lhs: Self::Primitive, rhs: E, ) -> Self::Primitive
Computes the modulo element-wise. The result is the signed remainder of the division and its absolute value is
less than that of the divisor. Read more
Source§fn mul(
lhs: Self::Primitive,
rhs: Self::Primitive,
) -> <Int as TensorKind<B>>::Primitive
fn mul( lhs: Self::Primitive, rhs: Self::Primitive, ) -> <Int as TensorKind<B>>::Primitive
Multiplies two tensors. Read more
Source§fn mul_scalar<E: ElementConversion>(
lhs: Self::Primitive,
rhs: E,
) -> Self::Primitive
fn mul_scalar<E: ElementConversion>( lhs: Self::Primitive, rhs: E, ) -> Self::Primitive
Multiplies a tensor by a scalar element-wise. Read more
Source§fn zeros(shape: Shape, device: &B::Device) -> Self::Primitive
fn zeros(shape: Shape, device: &B::Device) -> Self::Primitive
Creates a tensor filled with zeros. Read more
Source§fn ones(shape: Shape, device: &B::Device) -> Self::Primitive
fn ones(shape: Shape, device: &B::Device) -> Self::Primitive
Creates a tensor filled with ones. Read more
Source§fn full<E: ElementConversion>(
shape: Shape,
fill_value: E,
device: &B::Device,
) -> Self::Primitive
fn full<E: ElementConversion>( shape: Shape, fill_value: E, device: &B::Device, ) -> Self::Primitive
Creates a tensor filled with elements equal to the given value. Read more
Source§fn sum(tensor: Self::Primitive) -> Self::Primitive
fn sum(tensor: Self::Primitive) -> Self::Primitive
Sums all the elements of the tensor. Read more
Source§fn sum_dim(tensor: Self::Primitive, dim: usize) -> Self::Primitive
fn sum_dim(tensor: Self::Primitive, dim: usize) -> Self::Primitive
Sums all the elements of the tensor along a dimension. Read more
Source§fn prod(tensor: Self::Primitive) -> Self::Primitive
fn prod(tensor: Self::Primitive) -> Self::Primitive
Computes the product of all the elements of the tensor. Read more
Source§fn prod_dim(tensor: Self::Primitive, dim: usize) -> Self::Primitive
fn prod_dim(tensor: Self::Primitive, dim: usize) -> Self::Primitive
Computes the product of all the elements of the tensor along a dimension. Read more
Source§fn mean(tensor: Self::Primitive) -> Self::Primitive
fn mean(tensor: Self::Primitive) -> Self::Primitive
Computes the mean of all the elements of the tensor. Read more
Source§fn mean_dim(tensor: Self::Primitive, dim: usize) -> Self::Primitive
fn mean_dim(tensor: Self::Primitive, dim: usize) -> Self::Primitive
Computes the mean of all the elements of the tensor along a dimension. Read more
Source§fn equal_elem(lhs: Self::Primitive, rhs: Self::Elem) -> B::BoolTensorPrimitive
fn equal_elem(lhs: Self::Primitive, rhs: Self::Elem) -> B::BoolTensorPrimitive
Element-wise equality between two tensors. Read more
Source§fn not_equal_elem(
lhs: Self::Primitive,
rhs: Self::Elem,
) -> B::BoolTensorPrimitive
fn not_equal_elem( lhs: Self::Primitive, rhs: Self::Elem, ) -> B::BoolTensorPrimitive
Element-wise non-equality between two tensors. Read more
Source§fn greater(lhs: Self::Primitive, rhs: Self::Primitive) -> B::BoolTensorPrimitive
fn greater(lhs: Self::Primitive, rhs: Self::Primitive) -> B::BoolTensorPrimitive
Element-wise greater than comparison between two tensors. Read more
Source§fn greater_elem(lhs: Self::Primitive, rhs: Self::Elem) -> B::BoolTensorPrimitive
fn greater_elem(lhs: Self::Primitive, rhs: Self::Elem) -> B::BoolTensorPrimitive
Element-wise greater than comparison between a tensor and a scalar. Read more
Source§fn greater_equal(
lhs: Self::Primitive,
rhs: Self::Primitive,
) -> B::BoolTensorPrimitive
fn greater_equal( lhs: Self::Primitive, rhs: Self::Primitive, ) -> B::BoolTensorPrimitive
Element-wise greater than or equal comparison between two tensors. Read more
Source§fn greater_equal_elem(
lhs: Self::Primitive,
rhs: Self::Elem,
) -> B::BoolTensorPrimitive
fn greater_equal_elem( lhs: Self::Primitive, rhs: Self::Elem, ) -> B::BoolTensorPrimitive
Element-wise greater than or equal comparison between a tensor and a scalar. Read more
Source§fn lower(lhs: Self::Primitive, rhs: Self::Primitive) -> B::BoolTensorPrimitive
fn lower(lhs: Self::Primitive, rhs: Self::Primitive) -> B::BoolTensorPrimitive
Element-wise less than comparison between two tensors. Read more
Source§fn lower_elem(lhs: Self::Primitive, rhs: Self::Elem) -> B::BoolTensorPrimitive
fn lower_elem(lhs: Self::Primitive, rhs: Self::Elem) -> B::BoolTensorPrimitive
Element-wise less than comparison between a tensor and a scalar. Read more
Source§fn lower_equal(
lhs: Self::Primitive,
rhs: Self::Primitive,
) -> B::BoolTensorPrimitive
fn lower_equal( lhs: Self::Primitive, rhs: Self::Primitive, ) -> B::BoolTensorPrimitive
Element-wise less than or equal comparison between two tensors. Read more
Source§fn lower_equal_elem(
lhs: Self::Primitive,
rhs: Self::Elem,
) -> B::BoolTensorPrimitive
fn lower_equal_elem( lhs: Self::Primitive, rhs: Self::Elem, ) -> B::BoolTensorPrimitive
Element-wise less than or equal comparison between a tensor and a scalar. Read more
Source§fn mask_where(
tensor: Self::Primitive,
mask: B::BoolTensorPrimitive,
source: Self::Primitive,
) -> Self::Primitive
fn mask_where( tensor: Self::Primitive, mask: B::BoolTensorPrimitive, source: Self::Primitive, ) -> Self::Primitive
Selects elements from a tensor based on a boolean mask. Read more
Source§fn mask_fill(
tensor: Self::Primitive,
mask: B::BoolTensorPrimitive,
value: Self::Elem,
) -> Self::Primitive
fn mask_fill( tensor: Self::Primitive, mask: B::BoolTensorPrimitive, value: Self::Elem, ) -> Self::Primitive
Fills elements of a tensor based on a boolean mask. Read more
Source§fn select(
tensor: Self::Primitive,
dim: usize,
indices: Tensor<B, 1, Int>,
) -> Self::Primitive
fn select( tensor: Self::Primitive, dim: usize, indices: Tensor<B, 1, Int>, ) -> Self::Primitive
Select tensor elements along the given dimension corresponding for the given indices. Read more
Source§fn select_assign(
tensor: Self::Primitive,
dim: usize,
indices: Tensor<B, 1, Int>,
values: Self::Primitive,
) -> Self::Primitive
fn select_assign( tensor: Self::Primitive, dim: usize, indices: Tensor<B, 1, Int>, values: Self::Primitive, ) -> Self::Primitive
Assign the selected elements along the given dimension corresponding to the given indices
from the value tensor. Read more
Source§fn gather(
dim: usize,
tensor: Self::Primitive,
indices: B::IntTensorPrimitive,
) -> Self::Primitive
fn gather( dim: usize, tensor: Self::Primitive, indices: B::IntTensorPrimitive, ) -> Self::Primitive
Gathers elements from a tensor along an axis. Read more
Source§fn scatter(
dim: usize,
tensor: Self::Primitive,
indices: B::IntTensorPrimitive,
values: Self::Primitive,
) -> Self::Primitive
fn scatter( dim: usize, tensor: Self::Primitive, indices: B::IntTensorPrimitive, values: Self::Primitive, ) -> Self::Primitive
Scatters elements into a tensor along an axis. Read more
Source§fn argmax(tensor: Self::Primitive, dim: usize) -> IntTensor<B>
fn argmax(tensor: Self::Primitive, dim: usize) -> IntTensor<B>
Gets the indices of the maximum elements of a tensor along an axis. Read more
Source§fn argmin(tensor: Self::Primitive, dim: usize) -> IntTensor<B>
fn argmin(tensor: Self::Primitive, dim: usize) -> IntTensor<B>
Gets the indices of the minimum elements of a tensor along an axis. Read more
Source§fn max(tensor: Self::Primitive) -> Self::Primitive
fn max(tensor: Self::Primitive) -> Self::Primitive
Gets the maximum elements of a tensor along an axis. Read more
Source§fn max_dim(tensor: Self::Primitive, dim: usize) -> Self::Primitive
fn max_dim(tensor: Self::Primitive, dim: usize) -> Self::Primitive
Gets the maximum elements of a tensor along an axis. Read more
Source§fn max_dim_with_indices(
tensor: Self::Primitive,
dim: usize,
) -> (Self::Primitive, IntTensor<B>)
fn max_dim_with_indices( tensor: Self::Primitive, dim: usize, ) -> (Self::Primitive, IntTensor<B>)
Gets the maximum elements of a tensor along an axis. Read more
Source§fn max_abs(tensor: Self::Primitive) -> Self::Primitive
fn max_abs(tensor: Self::Primitive) -> Self::Primitive
Gets the maximum elements of a tensor along an axis. Read more
Source§fn max_abs_dim(tensor: Self::Primitive, dim: usize) -> Self::Primitive
fn max_abs_dim(tensor: Self::Primitive, dim: usize) -> Self::Primitive
Gets the maximum elements of a tensor along an axis. Read more
Source§fn min(tensor: Self::Primitive) -> Self::Primitive
fn min(tensor: Self::Primitive) -> Self::Primitive
Gets the minimum elements of a tensor along an axis. Read more
Source§fn min_dim(tensor: Self::Primitive, dim: usize) -> Self::Primitive
fn min_dim(tensor: Self::Primitive, dim: usize) -> Self::Primitive
Gets the minimum elements of a tensor along an axis. Read more
Source§fn min_dim_with_indices(
tensor: Self::Primitive,
dim: usize,
) -> (Self::Primitive, IntTensor<B>)
fn min_dim_with_indices( tensor: Self::Primitive, dim: usize, ) -> (Self::Primitive, IntTensor<B>)
Gets the minimum elements and indices of a tensor along an axis. Read more
Source§fn clamp(
tensor: Self::Primitive,
min: B::IntElem,
max: B::IntElem,
) -> Self::Primitive
fn clamp( tensor: Self::Primitive, min: B::IntElem, max: B::IntElem, ) -> Self::Primitive
Clamp the tensor between the given min and max values. Read more
Source§fn clamp_min(tensor: Self::Primitive, min: B::IntElem) -> Self::Primitive
fn clamp_min(tensor: Self::Primitive, min: B::IntElem) -> Self::Primitive
Clamps a tensor under a minimum value. Read more
Source§fn clamp_max(tensor: Self::Primitive, max: B::IntElem) -> Self::Primitive
fn clamp_max(tensor: Self::Primitive, max: B::IntElem) -> Self::Primitive
Clamps a tensor over a maximum value. Read more
Source§fn abs(tensor: Self::Primitive) -> Self::Primitive
fn abs(tensor: Self::Primitive) -> Self::Primitive
Calculate absolute value on all elements of a tensor Read more
Source§fn powf(lhs: Self::Primitive, rhs: Self::Primitive) -> Self::Primitive
fn powf(lhs: Self::Primitive, rhs: Self::Primitive) -> Self::Primitive
Element-wise power of a tensor to a float tensor Read more
Source§fn powf_scalar<E: ElementConversion>(
lhs: Self::Primitive,
rhs: E,
) -> <Int as TensorKind<B>>::Primitive
fn powf_scalar<E: ElementConversion>( lhs: Self::Primitive, rhs: E, ) -> <Int as TensorKind<B>>::Primitive
Element-wise power of a tensor to a scalar float Read more
Source§fn powi(lhs: Self::Primitive, rhs: Self::Primitive) -> Self::Primitive
fn powi(lhs: Self::Primitive, rhs: Self::Primitive) -> Self::Primitive
Element-wise power of a tensor Read more
Source§fn powi_scalar<E: ElementConversion>(
lhs: Self::Primitive,
rhs: E,
) -> Self::Primitive
fn powi_scalar<E: ElementConversion>( lhs: Self::Primitive, rhs: E, ) -> Self::Primitive
Element-wise power of a tensor to a scalar int Read more
Source§fn random(
shape: Shape,
distribution: Distribution,
device: &Device<B>,
) -> Self::Primitive
fn random( shape: Shape, distribution: Distribution, device: &Device<B>, ) -> Self::Primitive
Create a random tensor. Read more
Source§fn sign(tensor: Self::Primitive) -> Self::Primitive
fn sign(tensor: Self::Primitive) -> Self::Primitive
Returns the signs of the elements of a tensor. Read more
Source§fn sort(
tensor: Self::Primitive,
dim: usize,
descending: bool,
) -> Self::Primitive
fn sort( tensor: Self::Primitive, dim: usize, descending: bool, ) -> Self::Primitive
Sort the elements of the input
tensor
by value along a given dimension. Read moreAuto Trait Implementations§
impl Freeze for Int
impl RefUnwindSafe for Int
impl Send for Int
impl Sync for Int
impl Unpin for Int
impl UnwindSafe for Int
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more