Skip to main content

TracedTensor

Struct TracedTensor 

Source
pub struct TracedTensor {
    pub id: TracedTensorId,
    pub rank: usize,
    pub dtype: DType,
    pub val: LocalValueId,
    /* private fields */
}

Fields§

§id: TracedTensorId§rank: usize§dtype: DType§val: LocalValueId

Implementations§

Source§

impl TracedTensor

Source

pub fn index_select(&self, axis: isize, positions: &[usize]) -> Result<Self>

Select entries from one axis using host-known positions.

§Examples
use tenferro_cpu::CpuBackend;
use tenferro_runtime::{GraphCompiler, GraphExecutor, Tensor, TracedTensor};

let x = TracedTensor::from_tensor_concrete_shape(
    Tensor::from_vec_col_major(vec![3], vec![10.0_f64, 20.0, 30.0]).unwrap(),
)
.unwrap();
let y = x.index_select(-1, &[2, 0]).unwrap();
let mut compiler = GraphCompiler::new();
let program = compiler.compile(&y).unwrap();
let out = GraphExecutor::new(CpuBackend::new()).run(&program).unwrap();

assert_eq!(
    out.as_slice::<f64>().unwrap(),
    &[30.0, 10.0],
);
Source

pub fn stack(tensors: &[&Self], dim: isize) -> Result<Self>

Stack tensors along a newly inserted axis.

§Examples
use tenferro_cpu::CpuBackend;
use tenferro_runtime::{GraphCompiler, GraphExecutor, Tensor, TracedTensor};

let a = TracedTensor::from_tensor_concrete_shape(Tensor::from_vec_col_major(vec![], vec![1.0_f64]).unwrap()).unwrap();
let b = TracedTensor::from_tensor_concrete_shape(Tensor::from_vec_col_major(vec![], vec![2.0_f64]).unwrap()).unwrap();
let stacked = TracedTensor::stack(&[&a, &b], -1).unwrap();
let mut compiler = GraphCompiler::new();
let program = compiler.compile(&stacked).unwrap();
let out = GraphExecutor::new(CpuBackend::new()).run(&program).unwrap();

assert_eq!(
    out.as_slice::<f64>().unwrap(),
    &[1.0, 2.0],
);
Source

pub fn concatenate(tensors: &[&Self], axis: usize) -> Result<Self>

Concatenate tensors along one existing axis.

Source§

impl TracedTensor

Source

pub fn graph(&self) -> &Arc<Graph<StdTensorOp>>

Return the graph that owns this traced tensor’s current value.

§Examples
use tenferro_runtime::TracedTensor;

let x = TracedTensor::from_vec_col_major(vec![1], vec![1.0_f64]).unwrap();
let _graph = x.graph();
Source

pub fn attached_data(&self) -> Option<&Arc<Tensor>>

Return the concrete tensor data attached to this traced value, if any.

Placeholder tensors created with input_concrete_shape or input_symbolic_shape have no attached data until execution bindings provide it.

§Examples
use tenferro_runtime::{DType, TracedTensor};

let concrete = TracedTensor::from_vec_col_major(vec![1], vec![1.0_f64]).unwrap();
assert!(concrete.attached_data().is_some());

let placeholder = TracedTensor::input_symbolic_shape(DType::F64, 1).unwrap();
assert!(placeholder.attached_data().is_none());
Source

pub fn from_tensor_concrete_shape(tensor: Tensor) -> Result<Self>

Build a TracedTensor leaf from a concrete Tensor, keeping its shape as a concrete shape_hint.

This is the common constructor when you have concrete tensor data that you want to use both for graph building and for evaluation. The resulting tensor is treated as a concrete-shape leaf by downstream passes (binary einsum decomposition, build-time reshape folding, etc.).

§Examples
use tenferro_runtime::{Tensor, TracedTensor};

let a = TracedTensor::from_tensor_concrete_shape(
    Tensor::from_vec_col_major(vec![2, 3], vec![1.0_f64, 2.0, 3.0, 4.0, 5.0, 6.0]).unwrap(),
)
.unwrap();
assert_eq!(a.rank, 2);
assert!(a.is_concrete_shape());
Source

pub fn from_tensor_symbolic_shape(tensor: Tensor) -> Result<Self>

Build a TracedTensor leaf from a concrete Tensor but advertise a symbolic shape during graph construction.

The tensor data is still attached (so plain eval works without bindings), but graph passes see the leaf as shape-symbolic. This is useful for building a single traced program that should not bake in shape-specific optimizations.

§Examples
use tenferro_runtime::{Tensor, TracedTensor};

let t = TracedTensor::from_tensor_symbolic_shape(
    Tensor::from_vec_col_major(vec![2, 3], vec![1.0_f64, 2.0, 3.0, 4.0, 5.0, 6.0]).unwrap(),
)
.unwrap();
assert_eq!(t.rank, 2);
assert!(!t.is_concrete_shape());
Source

pub fn input_concrete_shape(dtype: DType, shape: &[usize]) -> Result<Self>

Build a data-less placeholder leaf with a fixed (concrete) shape.

Must be bound via crate::GraphExecutor::run_with_inputs before evaluation. Use this when you know the exact shape of the input but want to build the graph once and feed different concrete tensors at execution time.

§Examples
use tenferro_tensor::DType;
use tenferro_runtime::TracedTensor;

let x = TracedTensor::input_concrete_shape(DType::F64, &[2, 3]).unwrap();
assert_eq!(x.rank, 2);
assert!(x.is_concrete_shape());
Source

pub fn input_symbolic_shape(dtype: DType, rank: usize) -> Result<Self>

Build a data-less placeholder leaf with the given rank but fully symbolic shape (every dim is a distinct SymDim::TensorAxis).

Must be bound via crate::GraphExecutor::run_with_inputs before evaluation. Use this to build shape-agnostic graphs.

§Examples
use tenferro_tensor::DType;
use tenferro_runtime::TracedTensor;

let x = TracedTensor::input_symbolic_shape(DType::F64, 2).unwrap();
assert_eq!(x.rank, 2);
assert!(!x.is_concrete_shape());
Source

pub fn from_vec_col_major<T: TensorScalar>( shape: Vec<usize>, data: Vec<T>, ) -> Result<Self>

Build a concrete-shape TracedTensor leaf from column-major typed Vec<T> data.

The data must already be in tenferro’s physical column-major order.

§Examples
use tenferro_runtime::TracedTensor;

let a = TracedTensor::from_vec_col_major(
    vec![2, 3],
    vec![1.0_f64, 4.0, 2.0, 5.0, 3.0, 6.0],
)?;
assert_eq!(a.rank, 2);
Source

pub fn is_concrete_shape(&self) -> bool

Returns true iff every dim of this tensor’s shape_hint is a constant SymDim (i.e. the shape is fully known at graph-build time).

§Examples
use tenferro_tensor::DType;
use tenferro_runtime::TracedTensor;

let a = TracedTensor::from_vec_col_major(vec![2, 3], vec![1.0_f64; 6]).unwrap();
let b = TracedTensor::input_symbolic_shape(DType::F64, 2).unwrap();
assert!(a.is_concrete_shape());
assert!(!b.is_concrete_shape());
Source

pub fn try_concrete_shape(&self) -> Option<Vec<usize>>

Return the fully-concrete shape of this tensor, if every dim of its shape-hint is a constant SymDim. Returns None if any dimension is symbolic.

This is the counterpart to Self::is_concrete_shape for callers that need to use the concrete shape (e.g. external composition wrappers building broadcast_in_dim payloads from known shapes).

§Examples
use tenferro_tensor::DType;
use tenferro_runtime::TracedTensor;

let a = TracedTensor::from_vec_col_major(vec![2, 3], vec![1.0_f64; 6]).unwrap();
assert_eq!(a.try_concrete_shape(), Some(vec![2, 3]));

let b = TracedTensor::input_symbolic_shape(DType::F64, 2).unwrap();
assert!(b.try_concrete_shape().is_none());
Source

pub fn concrete_shape(&self) -> Result<Vec<usize>>

Return the concrete tensor shape.

Returns an error when a shape hint is missing or any dimension is symbolic. Composite traced ops that require concrete sizes should propagate this error instead of panicking.

Source

pub fn input_key(&self) -> Option<TensorInputKey>

If this TracedTensor is a leaf (single-node input graph), return its input key. Computed tensors return None.

Source

pub fn add(&self, other: &TracedTensor) -> Result<TracedTensor>

Elementwise addition with NumPy-style broadcasting.

Prefer using the + operator when it reads naturally.

§Examples
let y = x.add(&z);
let y2 = &x + &z;
Source

pub fn sub(&self, other: &TracedTensor) -> Result<TracedTensor>

Elementwise subtraction with NumPy-style broadcasting.

Prefer using the - operator when it reads naturally.

Source

pub fn mul(&self, other: &TracedTensor) -> Result<TracedTensor>

Elementwise multiplication with NumPy-style broadcasting.

Prefer using the * operator when it reads naturally.

§Examples
let y = x.mul(&z);
let y2 = &x * &z;
Source

pub fn div(&self, other: &TracedTensor) -> Result<TracedTensor>

Elementwise division with NumPy-style broadcasting.

Prefer using the / operator when it reads naturally.

§Examples
let y = x.div(&z);
let y2 = &x / &z;
Source

pub fn compare( &self, other: &TracedTensor, dir: CompareDir, ) -> Result<TracedTensor>

Elementwise comparison with NumPy-style broadcasting.

Source

pub fn maximum(&self, other: &TracedTensor) -> Result<TracedTensor>

Elementwise maximum with NumPy-style broadcasting.

Source

pub fn minimum(&self, other: &TracedTensor) -> Result<TracedTensor>

Elementwise minimum with NumPy-style broadcasting.

Source

pub fn where_select( condition: &TracedTensor, on_true: &TracedTensor, on_false: &TracedTensor, ) -> Result<TracedTensor>

Select values from on_true or on_false using condition.

Source

pub fn select( condition: &TracedTensor, on_true: &TracedTensor, on_false: &TracedTensor, ) -> Result<TracedTensor>

Alias for Self::where_select.

Source

pub fn clamp( &self, lower: &TracedTensor, upper: &TracedTensor, ) -> Result<TracedTensor>

Clamp values elementwise between lower and upper bounds.

Source

pub fn neg(&self) -> TracedTensor

Elementwise negation.

Prefer using the unary - operator when it reads naturally.

§Examples
let y = x.neg();
let y2 = -&x;
Source

pub fn conj(&self) -> TracedTensor

Elementwise complex conjugate.

§Examples
let y = x.conj();
Source

pub fn abs(&self) -> TracedTensor

Elementwise absolute value.

Complex inputs return real magnitudes (C32 -> F32, C64 -> F64).

§Examples
let y = x.abs();
Source

pub fn sign(&self) -> TracedTensor

Elementwise sign.

§Examples
let y = x.sign();
Source

pub fn scale_real(&self, factor: f64) -> TracedTensor

Scale by a real scalar: y = factor * x.

§Examples
let y = x.scale_real(2.0);
Source

pub fn scale_complex(&self, factor: Complex64) -> Result<TracedTensor>

Scale by a complex scalar: y = factor * x.

Only complex tensors support complex scaling. For a real scalar factor that should preserve the input dtype, prefer scale_real.

§Examples
use num_complex::Complex64;
let y = x.scale_complex(Complex64::new(0.0, 1.0)).unwrap(); // multiply by i
Source

pub fn exp(&self) -> TracedTensor

Elementwise exponential.

§Examples
let y = x.exp();
Source

pub fn log(&self) -> TracedTensor

Elementwise natural logarithm.

§Examples
let y = x.log();
Source

pub fn sin(&self) -> TracedTensor

Elementwise sine.

§Examples
let y = x.sin();
Source

pub fn cos(&self) -> TracedTensor

Elementwise cosine.

§Examples
let y = x.cos();
Source

pub fn tanh(&self) -> TracedTensor

Elementwise hyperbolic tangent.

§Examples
let y = x.tanh();
Source

pub fn sqrt(&self) -> TracedTensor

Elementwise square root.

§Examples
let y = x.sqrt();
Source

pub fn rsqrt(&self) -> TracedTensor

Elementwise reciprocal square root.

§Examples
let y = x.rsqrt();
Source

pub fn pow(&self, other: &TracedTensor) -> Result<TracedTensor>

Elementwise power with NumPy-style broadcasting.

§Examples
let y = base.pow(&exp);
Source

pub fn expm1(&self) -> TracedTensor

Elementwise exp(x) - 1.

§Examples
let y = x.expm1();
Source

pub fn log1p(&self) -> TracedTensor

Elementwise log(1 + x).

§Examples
let y = x.log1p();
Source

pub fn convert(&self, to: DType) -> Result<TracedTensor>

Convert the tensor to a different dtype using checked conversion.

Use cast when a lossy dtype projection is intended.

§Examples
use tenferro_runtime::DType;

let y = x.convert(DType::C64)?;
§Errors

Returns an error when the requested conversion is outside tenferro’s checked dtype-promotion lattice. Use cast for explicit lossy dtype projection.

Source

pub fn cast(&self, to: DType) -> TracedTensor

Cast the tensor to a different dtype using explicit dtype projection.

cast may truncate, narrow precision, project complex values to their real component, or use boolean truthiness where the backend supports the requested projection.

§Examples
use tenferro_runtime::DType;

let y = x.cast(DType::I32);
Source

pub fn dot_general( &self, other: &TracedTensor, config: DotGeneralConfig, ) -> Result<TracedTensor>

Generalized tensor contraction.

§Examples
let y = a.dot_general(&b, config)?;
§Errors

Returns an error when the dimension-numbering configuration is invalid for the operand ranks.

Source

pub fn matmul(&self, other: &TracedTensor) -> Result<TracedTensor>

Matrix multiplication for rank-2 tensors.

Source

pub fn reduce_sum(&self, axes: &[usize]) -> Result<TracedTensor>

Sum over the given axes.

§Examples
let y = x.reduce_sum(&[0])?;
let y2 = x.reduce_sum(&[0])?;
§Errors

Returns an error when an axis is out of bounds or duplicated.

Source

pub fn reduce_max(&self, axes: &[usize]) -> Result<TracedTensor>

Reduce by taking the maximum along the given axes.

Used by tropical (max-plus) compositions: a max-plus reduction over an axis is ReduceMax on that axis.

§Examples
let y = x.reduce_max(&[0])?;
§Errors

Returns an error when an axis is out of bounds or duplicated.

Source

pub fn reduce_min(&self, axes: &[usize]) -> Result<TracedTensor>

Reduce by taking the minimum along the given axes.

Used by tropical (min-plus) compositions: a min-plus reduction over an axis is ReduceMin on that axis.

§Examples
let y = x.reduce_min(&[0])?;
§Errors

Returns an error when an axis is out of bounds or duplicated.

Source

pub fn reduce_prod(&self, axes: &[usize]) -> Result<TracedTensor>

Reduce by taking the product along the given axes.

§Examples
let y = x.reduce_prod(&[0])?;
§Errors

Returns an error when an axis is out of bounds or duplicated.

Source

pub fn reshape(&self, shape: &[usize]) -> TracedTensor

Reshape without changing element order.

§Examples
let y = x.reshape(&[2, 2]);
Source

pub fn sym_size(&self, axis: usize) -> Result<SymDim>

Return a symbolic expression for the size of one axis, suitable as an InputDim-style reference when composing with TracedTensor::reshape_sym.

Semantics: if this tensor’s shape_hint has a symbolic (non-constant) entry for axis, that entry is returned verbatim. Otherwise — including when shape_hint[axis] is a concrete SymDim::Concrete(n) — a SymDim::tensor_axis(self.id, axis) reference is returned so the resulting graph remains shape-polymorphic if the same graph is later evaluated against a differently-shaped binding.

For a canonical “what is the size of this axis?” query that reports the concrete size when it is known, prefer Self::axis_sym_dim.

§Examples
let rows = x.sym_size(0)?;
let cols = x.sym_size(1)?;
let y = x.reshape_sym(&[rows * cols]).unwrap();
§Errors

Returns an error when axis is out of bounds.

Source

pub fn axis_sym_dim(&self, axis: usize) -> Result<SymDim>

Return the canonical SymDim for axis — the concrete SymDim::Concrete(n) when the size is known, otherwise a symbolic expression identifying this tensor’s axis.

Unlike Self::sym_size, this method does not rewrite concrete axes into TensorAxis references. It is the accessor external composition wrappers should use when building mixed concrete/symbolic target shapes for operations like Self::broadcast_in_dim_sym.

§Examples
use tenferro_tensor::DType;
use tenferro_runtime::TracedTensor;

let a = TracedTensor::from_vec_col_major(vec![2, 3], vec![1.0_f64; 6]).unwrap();
// Concrete axis: reports the constant size.
assert_eq!(a.axis_sym_dim(0).unwrap().constant_value(), Some(2));

let b = TracedTensor::input_symbolic_shape(DType::F64, 2).unwrap();
// Fully symbolic leaf: reports a TensorAxis reference.
assert!(b.axis_sym_dim(0).unwrap().constant_value().is_none());
§Errors

Returns an error when axis is out of bounds.

Source

pub fn sym_shape(&self) -> Option<&[SymDim]>

Return the full symbolic shape of this tensor when a shape_hint is present.

Returns None for fully-symbolic placeholders produced via Self::input_symbolic_shape (where shape_hint is intentionally absent). For those, build the shape axis-by-axis via Self::axis_sym_dim.

§Examples
use tenferro_tensor::DType;
use tenferro_runtime::TracedTensor;

let a = TracedTensor::from_vec_col_major(vec![2, 3], vec![1.0_f64; 6]).unwrap();
assert!(a.sym_shape().is_some());
assert_eq!(a.sym_shape().unwrap().len(), 2);

let b = TracedTensor::input_symbolic_shape(DType::F64, 2).unwrap();
assert!(b.sym_shape().is_none());
Source

pub fn reshape_sym(&self, shape: &[SymDim]) -> Result<TracedTensor>

Reshape using symbolic dimensions derived from traced tensor axes.

§Examples
let rows = x.sym_size(0)?;
let cols = x.sym_size(1)?;
let y = x.reshape_sym(&[rows * cols]).unwrap();
Source

pub fn broadcast_in_dim( &self, shape: &[usize], dims: &[usize], ) -> Result<TracedTensor>

Broadcast into a larger shape with explicit dimension placement.

§Examples
let y = x.broadcast_in_dim(&[2, 3], &[1])?;
§Errors

Returns an error when dims is not a duplicate-free mapping from every input axis into the output rank, or when a known input dimension cannot broadcast to the corresponding output dimension.

Source

pub fn broadcast_in_dim_sym( &self, shape: &[SymDim], dims: &[usize], shape_refs: &[&TracedTensor], ) -> Result<TracedTensor>

Broadcast into a symbolic target shape with explicit dimension placement.

Unlike Self::broadcast_in_dim, each axis of shape is a SymDim, so the target shape can mix concrete sizes (via SymDim::from(n)) with symbolic references to this tensor’s axes (via Self::axis_sym_dim) or to axes of other traced tensors.

When shape contains a SymDim that references a traced tensor other than self, the referenced tensor(s) must be supplied in shape_refs. They are wired into the built op as auxiliary shape-reference inputs — the op does not read their data, only their runtime shape. shape_refs must be listed in the same order in which their tensor IDs first appear when walking shape after any references to self. Usually the simplest correct thing is to pass each unique non-self reference tensor once.

§Examples
use tenferro_runtime::TracedTensor;

let a = TracedTensor::from_vec_col_major(vec![2, 3], vec![1.0_f64; 6]).unwrap();
let b = TracedTensor::from_vec_col_major(vec![3, 4], vec![1.0_f64; 12]).unwrap();
let m = a.axis_sym_dim(0)?;
let k = a.axis_sym_dim(1)?;
let n = b.axis_sym_dim(1)?;
// Broadcast `a[m, k]` to `[m, k, n]`, placing `a`'s axes at 0, 1
// and taking `n` from `b` as an auxiliary shape reference.
let a_b = a.broadcast_in_dim_sym(&[m, k, n], &[0, 1], &[&b])?;
assert_eq!(a_b.rank, 3);
Source

pub fn slice(&self, config: SliceConfig) -> Result<TracedTensor>

Slice with explicit start, limit, and stride per axis.

Source

pub fn pad(&self, config: PadConfig) -> Result<TracedTensor>

Pad with zeros using StableHLO-style edge and interior padding.

Source

pub fn reverse(&self, axes: &[usize]) -> Result<TracedTensor>

Reverse the order of elements along the requested axes.

Source

pub fn gather( &self, indices: &TracedTensor, config: GatherConfig, ) -> Result<TracedTensor>

Gather slices from self using integer start indices.

Source

pub fn scatter( &self, indices: &TracedTensor, updates: &TracedTensor, config: ScatterConfig, ) -> Result<TracedTensor>

Scatter updates into self using StableHLO scatter semantics.

Source

pub fn dynamic_slice( &self, starts: &TracedTensor, sizes: &[usize], ) -> Result<TracedTensor>

Slice using runtime start indices.

Source

pub fn tril(&self, k: i64) -> TracedTensor

Keep the lower triangle and zero the rest.

Source

pub fn triu(&self, k: i64) -> TracedTensor

Keep the upper triangle and zero the rest.

Source

pub fn transpose(&self, perm: &[usize]) -> Result<TracedTensor>

Permute tensor axes.

§Examples
let y = x.transpose(&[1, 0])?;
§Errors

Returns an error when perm is not a valid permutation of the tensor axes.

Source

pub fn extract_diag(&self, axis_a: usize, axis_b: usize) -> Result<TracedTensor>

Extract the diagonal along two axes.

§Examples
let y = x.extract_diag(0, 1)?;
§Errors

Returns an error when either axis is out of bounds or the two axes are equal.

Source

pub fn embed_diag(&self, axis_a: usize, axis_b: usize) -> Result<TracedTensor>

Embed a vector or lower-rank tensor along a diagonal.

§Examples
let y = x.embed_diag(0, 1)?;
§Errors

Returns an error when axis_a is out of bounds or axis_b is not a valid insertion axis.

Source

pub fn shape_of(&self, axis: usize) -> Result<TracedTensor>

Return the runtime size of one axis as a scalar f64 tensor.

The result is metadata-derived and therefore has no gradient.

§Examples
use tenferro_cpu::CpuBackend;
use tenferro_runtime::{GraphCompiler, GraphExecutor, TracedTensor};

let x = TracedTensor::from_vec_col_major(vec![2, 3], vec![1.0_f64, 2.0, 3.0, 4.0, 5.0, 6.0]).unwrap();
let cols = x.shape_of(1)?;
let mut compiler = GraphCompiler::new();
let program = compiler.compile(&cols).unwrap();
let out = GraphExecutor::new(CpuBackend::new()).run(&program).unwrap();
assert_eq!(out.shape(), &[] as &[usize]);
§Errors

Returns an error when axis is out of bounds.

Source

pub fn dynamic_truncate( &self, size: &TracedTensor, axis: usize, ) -> Result<TracedTensor>

Truncate this tensor along axis to the first size elements.

size is read at runtime from a scalar traced tensor. Values are rounded to the nearest integer, clamped to [0, self.shape[axis]], and the output keeps the same element dtype as the input.

§Examples
use tenferro_cpu::CpuBackend;
use tenferro_runtime::{GraphCompiler, GraphExecutor, TracedTensor};

let x = TracedTensor::from_vec_col_major(vec![4], vec![1.0_f64, 2.0, 3.0, 4.0]).unwrap();
let size = TracedTensor::from_vec_col_major(vec![], vec![2.0_f64]).unwrap();
let y = x.dynamic_truncate(&size, 0)?;
let mut compiler = GraphCompiler::new();
let program = compiler.compile(&y).unwrap();
let out = GraphExecutor::new(CpuBackend::new()).run(&program).unwrap();
assert_eq!(out.shape(), &[2]);
§Errors

Returns an error when axis is out of bounds or size is not scalar.

Source

pub fn pad_to_match( &self, reference: &TracedTensor, axis: usize, ) -> Result<TracedTensor>

Pad this tensor with zeros along axis to match reference.shape[axis].

If reference is smaller along that axis, this is a no-op.

§Examples
use tenferro_cpu::CpuBackend;
use tenferro_runtime::{GraphCompiler, GraphExecutor, TracedTensor};

let x = TracedTensor::from_vec_col_major(vec![2], vec![1.0_f64, 2.0]).unwrap();
let reference = TracedTensor::from_vec_col_major(vec![4], vec![0.0_f64, 0.0, 0.0, 0.0]).unwrap();
let y = x.pad_to_match(&reference, 0)?;
let mut compiler = GraphCompiler::new();
let program = compiler.compile(&y).unwrap();
let out = GraphExecutor::new(CpuBackend::new()).run(&program).unwrap();
assert_eq!(out.shape(), &[4]);
§Errors

Returns an error when axis is out of bounds for either tensor.

Trait Implementations§

Source§

impl Add for &TracedTensor

Source§

type Output = Result<TracedTensor, Error>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &TracedTensor) -> Result<TracedTensor>

Performs the + operation. Read more
Source§

impl Clone for TracedTensor

Source§

fn clone(&self) -> TracedTensor

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TracedTensor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Div for &TracedTensor

Source§

type Output = Result<TracedTensor, Error>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &TracedTensor) -> Result<TracedTensor>

Performs the / operation. Read more
Source§

impl Mul<&TracedTensor> for f64

Source§

type Output = TracedTensor

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &TracedTensor) -> TracedTensor

Performs the * operation. Read more
Source§

impl Mul<f64> for &TracedTensor

Source§

type Output = TracedTensor

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f64) -> TracedTensor

Performs the * operation. Read more
Source§

impl Mul for &TracedTensor

Source§

type Output = Result<TracedTensor, Error>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &TracedTensor) -> Result<TracedTensor>

Performs the * operation. Read more
Source§

impl Neg for &TracedTensor

Source§

type Output = TracedTensor

The resulting type after applying the - operator.
Source§

fn neg(self) -> TracedTensor

Performs the unary - operation. Read more
Source§

impl Sub for &TracedTensor

Source§

type Output = Result<TracedTensor, Error>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &TracedTensor) -> Result<TracedTensor>

Performs the - operation. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.