pub struct TracedTensor { /* private fields */ }Expand description
A traced tensor — records ops instead of executing them.
Implementations§
Source§impl TracedTensor
impl TracedTensor
pub fn matmul(self, rhs: TracedTensor) -> TracedTensor
pub fn gelu(self) -> TracedTensor
pub fn silu(self) -> TracedTensor
pub fn relu(self) -> TracedTensor
pub fn layer_norm( self, gamma: TracedTensor, beta: TracedTensor, eps: f32, ) -> TracedTensor
pub fn softmax(self, axis: i32) -> TracedTensor
pub fn reshape(self, new_shape: &[i64]) -> TracedTensor
pub fn transpose(self, perm: &[usize]) -> TracedTensor
pub fn narrow(self, axis: usize, start: usize, len: usize) -> TracedTensor
Sourcepub fn t(&self) -> TracedTensor
pub fn t(&self) -> TracedTensor
2-D transpose shorthand. t.t() swaps the last two axes,
matching PyTorch’s .t() for matrices.
Sourcepub fn permute(&self, perm: &[usize]) -> TracedTensor
pub fn permute(&self, perm: &[usize]) -> TracedTensor
Permute dimensions — alias of Self::transpose under
PyTorch’s name.
Sourcepub fn unsqueeze(&self, axis: usize) -> TracedTensor
pub fn unsqueeze(&self, axis: usize) -> TracedTensor
Insert a length-1 dim at axis. Bumps every existing dim
at >= axis by one position.
Sourcepub fn squeeze(&self, axis: usize) -> TracedTensor
pub fn squeeze(&self, axis: usize) -> TracedTensor
Drop a length-1 dim at axis. Errors at compile-time-of-
graph if the dim isn’t 1.
Sourcepub fn mm(&self, rhs: &TracedTensor) -> TracedTensor
pub fn mm(&self, rhs: &TracedTensor) -> TracedTensor
Reference-friendly matmul. a.mm(&b) doesn’t move either.
Trait Implementations§
Source§impl Add<&TracedTensor> for &TracedTensor
impl Add<&TracedTensor> for &TracedTensor
Source§type Output = TracedTensor
type Output = TracedTensor
The resulting type after applying the
+ operator.Source§fn add(self, rhs: &TracedTensor) -> TracedTensor
fn add(self, rhs: &TracedTensor) -> TracedTensor
Performs the
+ operation. Read moreSource§impl Add<&TracedTensor> for TracedTensor
impl Add<&TracedTensor> for TracedTensor
Source§type Output = TracedTensor
type Output = TracedTensor
The resulting type after applying the
+ operator.Source§fn add(self, rhs: &TracedTensor) -> TracedTensor
fn add(self, rhs: &TracedTensor) -> TracedTensor
Performs the
+ operation. Read moreSource§impl Add<TracedTensor> for &TracedTensor
impl Add<TracedTensor> for &TracedTensor
Source§type Output = TracedTensor
type Output = TracedTensor
The resulting type after applying the
+ operator.Source§fn add(self, rhs: TracedTensor) -> TracedTensor
fn add(self, rhs: TracedTensor) -> TracedTensor
Performs the
+ operation. Read moreSource§impl Add for TracedTensor
impl Add for TracedTensor
Source§type Output = TracedTensor
type Output = TracedTensor
The resulting type after applying the
+ operator.Source§fn add(self, rhs: TracedTensor) -> TracedTensor
fn add(self, rhs: TracedTensor) -> TracedTensor
Performs the
+ operation. Read moreSource§impl Clone for TracedTensor
impl Clone for TracedTensor
Source§fn clone(&self) -> TracedTensor
fn clone(&self) -> TracedTensor
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Div<&TracedTensor> for &TracedTensor
impl Div<&TracedTensor> for &TracedTensor
Source§type Output = TracedTensor
type Output = TracedTensor
The resulting type after applying the
/ operator.Source§fn div(self, rhs: &TracedTensor) -> TracedTensor
fn div(self, rhs: &TracedTensor) -> TracedTensor
Performs the
/ operation. Read moreSource§impl Div<&TracedTensor> for TracedTensor
impl Div<&TracedTensor> for TracedTensor
Source§type Output = TracedTensor
type Output = TracedTensor
The resulting type after applying the
/ operator.Source§fn div(self, rhs: &TracedTensor) -> TracedTensor
fn div(self, rhs: &TracedTensor) -> TracedTensor
Performs the
/ operation. Read moreSource§impl Div<TracedTensor> for &TracedTensor
impl Div<TracedTensor> for &TracedTensor
Source§type Output = TracedTensor
type Output = TracedTensor
The resulting type after applying the
/ operator.Source§fn div(self, rhs: TracedTensor) -> TracedTensor
fn div(self, rhs: TracedTensor) -> TracedTensor
Performs the
/ operation. Read moreSource§impl Div for TracedTensor
impl Div for TracedTensor
Source§type Output = TracedTensor
type Output = TracedTensor
The resulting type after applying the
/ operator.Source§fn div(self, rhs: TracedTensor) -> TracedTensor
fn div(self, rhs: TracedTensor) -> TracedTensor
Performs the
/ operation. Read moreSource§impl Mul<&TracedTensor> for &TracedTensor
impl Mul<&TracedTensor> for &TracedTensor
Source§type Output = TracedTensor
type Output = TracedTensor
The resulting type after applying the
* operator.Source§fn mul(self, rhs: &TracedTensor) -> TracedTensor
fn mul(self, rhs: &TracedTensor) -> TracedTensor
Performs the
* operation. Read moreSource§impl Mul<&TracedTensor> for TracedTensor
impl Mul<&TracedTensor> for TracedTensor
Source§type Output = TracedTensor
type Output = TracedTensor
The resulting type after applying the
* operator.Source§fn mul(self, rhs: &TracedTensor) -> TracedTensor
fn mul(self, rhs: &TracedTensor) -> TracedTensor
Performs the
* operation. Read moreSource§impl Mul<TracedTensor> for &TracedTensor
impl Mul<TracedTensor> for &TracedTensor
Source§type Output = TracedTensor
type Output = TracedTensor
The resulting type after applying the
* operator.Source§fn mul(self, rhs: TracedTensor) -> TracedTensor
fn mul(self, rhs: TracedTensor) -> TracedTensor
Performs the
* operation. Read moreSource§impl Mul for TracedTensor
impl Mul for TracedTensor
Source§type Output = TracedTensor
type Output = TracedTensor
The resulting type after applying the
* operator.Source§fn mul(self, rhs: TracedTensor) -> TracedTensor
fn mul(self, rhs: TracedTensor) -> TracedTensor
Performs the
* operation. Read moreSource§impl Neg for &TracedTensor
impl Neg for &TracedTensor
Source§type Output = TracedTensor
type Output = TracedTensor
The resulting type after applying the
- operator.Source§fn neg(self) -> TracedTensor
fn neg(self) -> TracedTensor
Performs the unary
- operation. Read moreSource§impl Neg for TracedTensor
impl Neg for TracedTensor
Source§type Output = TracedTensor
type Output = TracedTensor
The resulting type after applying the
- operator.Source§fn neg(self) -> TracedTensor
fn neg(self) -> TracedTensor
Performs the unary
- operation. Read moreSource§impl Sub<&TracedTensor> for &TracedTensor
impl Sub<&TracedTensor> for &TracedTensor
Source§type Output = TracedTensor
type Output = TracedTensor
The resulting type after applying the
- operator.Source§fn sub(self, rhs: &TracedTensor) -> TracedTensor
fn sub(self, rhs: &TracedTensor) -> TracedTensor
Performs the
- operation. Read moreSource§impl Sub<&TracedTensor> for TracedTensor
impl Sub<&TracedTensor> for TracedTensor
Source§type Output = TracedTensor
type Output = TracedTensor
The resulting type after applying the
- operator.Source§fn sub(self, rhs: &TracedTensor) -> TracedTensor
fn sub(self, rhs: &TracedTensor) -> TracedTensor
Performs the
- operation. Read moreSource§impl Sub<TracedTensor> for &TracedTensor
impl Sub<TracedTensor> for &TracedTensor
Source§type Output = TracedTensor
type Output = TracedTensor
The resulting type after applying the
- operator.Source§fn sub(self, rhs: TracedTensor) -> TracedTensor
fn sub(self, rhs: TracedTensor) -> TracedTensor
Performs the
- operation. Read moreSource§impl Sub for TracedTensor
impl Sub for TracedTensor
Source§type Output = TracedTensor
type Output = TracedTensor
The resulting type after applying the
- operator.Source§fn sub(self, rhs: TracedTensor) -> TracedTensor
fn sub(self, rhs: TracedTensor) -> TracedTensor
Performs the
- operation. Read moreAuto Trait Implementations§
impl Freeze for TracedTensor
impl !RefUnwindSafe for TracedTensor
impl !Send for TracedTensor
impl !Sync for TracedTensor
impl Unpin for TracedTensor
impl UnsafeUnpin for TracedTensor
impl !UnwindSafe for TracedTensor
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