pub struct Trace;Expand description
The tracing backend: programs record their operations as IR. Values are
TraceRefs into the trace in progress.
Trait Implementations§
Source§impl Backend for Trace
impl Backend for Trace
Source§fn select<T: Element>(c: TraceRef, t: TraceRef, f: TraceRef) -> TraceRef
fn select<T: Element>(c: TraceRef, t: TraceRef, f: TraceRef) -> TraceRef
if c { t } else { f }.Source§fn bitcast<T: Element, U: Element>(x: TraceRef) -> TraceRef
fn bitcast<T: Element, U: Element>(x: TraceRef) -> TraceRef
Reinterpretation of the bits as another type of the same size.
Source§fn to_real<T: Element>(op: ToReal, x: TraceRef) -> TraceRef
fn to_real<T: Element>(op: ToReal, x: TraceRef) -> TraceRef
abs, real, or imag (real and imag of complex numbers).Source§fn complex<C: Element>(re: TraceRef, im: TraceRef) -> TraceRef
fn complex<C: Element>(re: TraceRef, im: TraceRef) -> TraceRef
A complex number from its parts (
lax.complex).Source§fn a_binary<T: Element>(op: BinaryOp, x: &TraceRef, y: &TraceRef) -> TraceRef
fn a_binary<T: Element>(op: BinaryOp, x: &TraceRef, y: &TraceRef) -> TraceRef
Elementwise binary operation on arrays of the same shape.
Source§fn a_ternary<T: Element>(
op: TernaryOp,
x: &TraceRef,
y: &TraceRef,
z: &TraceRef,
) -> TraceRef
fn a_ternary<T: Element>( op: TernaryOp, x: &TraceRef, y: &TraceRef, z: &TraceRef, ) -> TraceRef
Elementwise ternary operation on arrays of the same shape.
Source§fn a_compare<T: Element>(op: CompareOp, x: &TraceRef, y: &TraceRef) -> TraceRef
fn a_compare<T: Element>(op: CompareOp, x: &TraceRef, y: &TraceRef) -> TraceRef
Elementwise comparison of arrays of the same shape.
Source§fn a_bitcast<T: Element, U: Element>(x: &TraceRef) -> TraceRef
fn a_bitcast<T: Element, U: Element>(x: &TraceRef) -> TraceRef
Elementwise bit reinterpretation.
Source§fn a_to_real<T: Element>(op: ToReal, x: &TraceRef) -> TraceRef
fn a_to_real<T: Element>(op: ToReal, x: &TraceRef) -> TraceRef
Elementwise
abs, real, or imag.Source§fn a_complex<C: Element>(re: &TraceRef, im: &TraceRef) -> TraceRef
fn a_complex<C: Element>(re: &TraceRef, im: &TraceRef) -> TraceRef
Elementwise
complex of arrays of the same shape.Source§fn a_select<T: Element>(c: &TraceRef, t: &TraceRef, f: &TraceRef) -> TraceRef
fn a_select<T: Element>(c: &TraceRef, t: &TraceRef, f: &TraceRef) -> TraceRef
select_n(c, f, t): c is a scalar or has the shape of the cases.Source§fn a_clamp<T: Element>(lo: &TraceRef, x: &TraceRef, hi: &TraceRef) -> TraceRef
fn a_clamp<T: Element>(lo: &TraceRef, x: &TraceRef, hi: &TraceRef) -> TraceRef
clamp(lo, x, hi): bounds are scalars or have the shape of x.Source§fn broadcast_in_dim<T: Element>(
x: &TraceRef,
shape: &[usize],
dims: &[usize],
) -> TraceRef
fn broadcast_in_dim<T: Element>( x: &TraceRef, shape: &[usize], dims: &[usize], ) -> TraceRef
broadcast_in_dim.Source§fn slice<T: Element>(
x: &TraceRef,
start: &[usize],
limit: &[usize],
strides: &[usize],
) -> TraceRef
fn slice<T: Element>( x: &TraceRef, start: &[usize], limit: &[usize], strides: &[usize], ) -> TraceRef
slice.Source§fn dynamic_slice<T: Element, I: Element>(
x: &TraceRef,
starts: &[TraceRef],
sizes: &[usize],
) -> TraceRef
fn dynamic_slice<T: Element, I: Element>( x: &TraceRef, starts: &[TraceRef], sizes: &[usize], ) -> TraceRef
dynamic_slice (start indices are clamped).Source§fn dynamic_update_slice<T: Element, I: Element>(
x: &TraceRef,
update: &TraceRef,
starts: &[TraceRef],
) -> TraceRef
fn dynamic_update_slice<T: Element, I: Element>( x: &TraceRef, update: &TraceRef, starts: &[TraceRef], ) -> TraceRef
dynamic_update_slice (start indices are clamped).Source§fn pad<T: Element>(
x: &TraceRef,
value: TraceRef,
config: &[(i64, i64, usize)],
) -> TraceRef
fn pad<T: Element>( x: &TraceRef, value: TraceRef, config: &[(i64, i64, usize)], ) -> TraceRef
pad.Source§fn reduce<T: Element>(op: ReduceOp, x: &TraceRef, axes: &[usize]) -> TraceRef
fn reduce<T: Element>(op: ReduceOp, x: &TraceRef, axes: &[usize]) -> TraceRef
A reduction over
axes.Source§fn arg_min_max<T: Element, I: Element>(
x: &TraceRef,
axis: usize,
max: bool,
) -> TraceRef
fn arg_min_max<T: Element, I: Element>( x: &TraceRef, axis: usize, max: bool, ) -> TraceRef
argmax or argmin.Source§fn sort(
operands: &[TraceRef],
dimension: usize,
is_stable: bool,
num_keys: usize,
) -> Vec<TraceRef>
fn sort( operands: &[TraceRef], dimension: usize, is_stable: bool, num_keys: usize, ) -> Vec<TraceRef>
sort of operands of the same shape (of any element types) along
dimension, lexicographically by the first num_keys of them.Source§fn cumulative<T: Element>(
op: CumulativeOp,
x: &TraceRef,
axis: usize,
reverse: bool,
) -> TraceRef
fn cumulative<T: Element>( op: CumulativeOp, x: &TraceRef, axis: usize, reverse: bool, ) -> TraceRef
A cumulative reduction along
axis (cumsum and the like), from
the end with reverse.Source§fn fft<T: Element, U: Element>(
x: &TraceRef,
fft_type: FftType,
fft_lengths: &[usize],
) -> TraceRef
fn fft<T: Element, U: Element>( x: &TraceRef, fft_type: FftType, fft_lengths: &[usize], ) -> TraceRef
fft of the trailing axes, from T to U (complex to complex,
real to complex, or complex to real).Source§fn top_k<T: Element>(
x: &TraceRef,
k: usize,
axis: usize,
) -> (TraceRef, TraceRef)
fn top_k<T: Element>( x: &TraceRef, k: usize, axis: usize, ) -> (TraceRef, TraceRef)
top_k along axis: the k largest elements in descending order,
and their indices.Source§fn cholesky<T: LinalgScalar>(x: &TraceRef) -> TraceRef
fn cholesky<T: LinalgScalar>(x: &TraceRef) -> TraceRef
cholesky of a batch of matrices (see lax::linalg::cholesky).Source§fn triangular_solve<T: LinalgScalar>(
a: &TraceRef,
b: &TraceRef,
options: TriangularSolveOptions,
) -> TraceRef
fn triangular_solve<T: LinalgScalar>( a: &TraceRef, b: &TraceRef, options: TriangularSolveOptions, ) -> TraceRef
triangular_solve of batches of matrices.Source§fn lu<T: LinalgScalar>(x: &TraceRef) -> (TraceRef, TraceRef, TraceRef)
fn lu<T: LinalgScalar>(x: &TraceRef) -> (TraceRef, TraceRef, TraceRef)
lu of a batch of matrices: the factors, the pivots, and the
permutation.Source§fn lu_pivots_to_permutation(pivots: &TraceRef, size: usize) -> TraceRef
fn lu_pivots_to_permutation(pivots: &TraceRef, size: usize) -> TraceRef
lu_pivots_to_permutation.Source§fn qr<T: LinalgScalar>(
x: &TraceRef,
full_matrices: bool,
) -> (TraceRef, TraceRef)
fn qr<T: LinalgScalar>( x: &TraceRef, full_matrices: bool, ) -> (TraceRef, TraceRef)
qr of a batch of matrices: q and r.Source§fn qr_pivoting<T: LinalgScalar>(
x: &TraceRef,
full_matrices: bool,
) -> (TraceRef, TraceRef, TraceRef)
fn qr_pivoting<T: LinalgScalar>( x: &TraceRef, full_matrices: bool, ) -> (TraceRef, TraceRef, TraceRef)
qr with column pivoting of a batch of matrices: q, r, and the
permutation.Source§fn eigh<T: LinalgScalar>(
x: &TraceRef,
lower: bool,
sort_eigenvalues: bool,
subset_by_index: Option<(usize, usize)>,
algorithm: Option<EighImplementation>,
) -> (TraceRef, TraceRef)
fn eigh<T: LinalgScalar>( x: &TraceRef, lower: bool, sort_eigenvalues: bool, subset_by_index: Option<(usize, usize)>, algorithm: Option<EighImplementation>, ) -> (TraceRef, TraceRef)
eigh of a batch of symmetric matrices: the eigenvectors and the
eigenvalues (of the range subset_by_index of indices, if given).Source§fn schur<T: LinalgScalar>(
x: &TraceRef,
compute_schur_vectors: bool,
) -> (TraceRef, Option<TraceRef>)
fn schur<T: LinalgScalar>( x: &TraceRef, compute_schur_vectors: bool, ) -> (TraceRef, Option<TraceRef>)
schur of a batch of square matrices: t and, with
compute_schur_vectors, z.Source§fn hessenberg<T: LinalgScalar>(x: &TraceRef) -> (TraceRef, TraceRef)
fn hessenberg<T: LinalgScalar>(x: &TraceRef) -> (TraceRef, TraceRef)
hessenberg of a batch of square matrices: the reduced matrices and
the factors of the reflectors.Source§fn householder_product<T: LinalgScalar>(
a: &TraceRef,
taus: &TraceRef,
) -> TraceRef
fn householder_product<T: LinalgScalar>( a: &TraceRef, taus: &TraceRef, ) -> TraceRef
householder_product of reflectors and their factors.Source§fn ormqr<T: LinalgScalar>(
a: &TraceRef,
taus: &TraceRef,
c: &TraceRef,
left: bool,
transpose: bool,
) -> TraceRef
fn ormqr<T: LinalgScalar>( a: &TraceRef, taus: &TraceRef, c: &TraceRef, left: bool, transpose: bool, ) -> TraceRef
ormqr: c times Q (or Q^H) of the reflectors.Source§fn cholesky_update<T: LinalgFloat>(r: &TraceRef, w: &TraceRef) -> TraceRef
fn cholesky_update<T: LinalgFloat>(r: &TraceRef, w: &TraceRef) -> TraceRef
cholesky_update: the rank-1 update by w of the upper triangular
Cholesky factors r.Source§fn symmetric_product<T: LinalgFloat>(
a: &TraceRef,
c: &TraceRef,
alpha: f64,
beta: f64,
) -> TraceRef
fn symmetric_product<T: LinalgFloat>( a: &TraceRef, c: &TraceRef, alpha: f64, beta: f64, ) -> TraceRef
symmetric_product: alpha a a^T + beta c.Source§fn tridiagonal<T: LinalgScalar>(
x: &TraceRef,
lower: bool,
) -> (TraceRef, TraceRef, TraceRef, TraceRef)
fn tridiagonal<T: LinalgScalar>( x: &TraceRef, lower: bool, ) -> (TraceRef, TraceRef, TraceRef, TraceRef)
tridiagonal of a batch of Hermitian matrices: the reduced matrices,
the real diagonals and off-diagonals, and the factors of the
reflectors.Source§fn tridiagonal_solve<T: LinalgScalar>(
dl: &TraceRef,
d: &TraceRef,
du: &TraceRef,
b: &TraceRef,
perturb_singular: bool,
) -> TraceRef
fn tridiagonal_solve<T: LinalgScalar>( dl: &TraceRef, d: &TraceRef, du: &TraceRef, b: &TraceRef, perturb_singular: bool, ) -> TraceRef
tridiagonal_solve: the solution of the tridiagonal systems of the
diagonals dl, d, and du ([..., m]) with the right-hand sides
b ([..., m, n]).Source§fn eig<T: LinalgScalar>(
x: &TraceRef,
left: bool,
right: bool,
enable_eigvec_derivs: bool,
) -> (TraceRef, Option<TraceRef>, Option<TraceRef>)
fn eig<T: LinalgScalar>( x: &TraceRef, left: bool, right: bool, enable_eigvec_derivs: bool, ) -> (TraceRef, Option<TraceRef>, Option<TraceRef>)
eig of a batch of general matrices: the complex eigenvalues, and
the left and right eigenvectors that are requested.Source§fn svd<T: LinalgScalar>(
x: &TraceRef,
full_matrices: bool,
compute_uv: bool,
subset_by_index: Option<(usize, usize)>,
algorithm: Option<SvdAlgorithm>,
) -> (TraceRef, Option<(TraceRef, TraceRef)>)
fn svd<T: LinalgScalar>( x: &TraceRef, full_matrices: bool, compute_uv: bool, subset_by_index: Option<(usize, usize)>, algorithm: Option<SvdAlgorithm>, ) -> (TraceRef, Option<(TraceRef, TraceRef)>)
svd of a batch of matrices: the singular values, and u and vt
with compute_uv (of the range subset_by_index of indices, if
given).Source§fn dot_general<T: Element, U: Element>(
l: &TraceRef,
r: &TraceRef,
dims: &DotDims,
precision: Precision,
) -> TraceRef
fn dot_general<T: Element, U: Element>( l: &TraceRef, r: &TraceRef, dims: &DotDims, precision: Precision, ) -> TraceRef
dot_general, computing in U (the operand type unless a preferred
type is given).Source§fn conv_general_dilated<T: Element, U: Element>(
lhs: &TraceRef,
rhs: &TraceRef,
window: &ConvWindow<'_>,
dims: &ConvDims,
groups: (usize, usize),
precision: Precision,
) -> TraceRef
fn conv_general_dilated<T: Element, U: Element>( lhs: &TraceRef, rhs: &TraceRef, window: &ConvWindow<'_>, dims: &ConvDims, groups: (usize, usize), precision: Precision, ) -> TraceRef
conv_general_dilated with (feature_group_count, batch_group_count) groups, computing in U (the operand type unless
a preferred type is given).Source§fn reduce_window<T: Element>(
op: ReduceOp,
x: &TraceRef,
window: &Window<'_>,
) -> TraceRef
fn reduce_window<T: Element>( op: ReduceOp, x: &TraceRef, window: &Window<'_>, ) -> TraceRef
reduce_window_sum, reduce_window_max, or reduce_window_min.Source§fn select_and_scatter_add<T: Element>(
source: &TraceRef,
operand: &TraceRef,
select_prim: SelectPrim,
window: &Window<'_>,
) -> TraceRef
fn select_and_scatter_add<T: Element>( source: &TraceRef, operand: &TraceRef, select_prim: SelectPrim, window: &Window<'_>, ) -> TraceRef
select_and_scatter_add (the window’s dilations must be 1).Source§fn select_and_gather_add<T: Element>(
tangents: &TraceRef,
operand: &TraceRef,
select_prim: SelectPrim,
window: &Window<'_>,
) -> TraceRef
fn select_and_gather_add<T: Element>( tangents: &TraceRef, operand: &TraceRef, select_prim: SelectPrim, window: &Window<'_>, ) -> TraceRef
select_and_gather_add.Source§fn gather<T: Element, I: Element>(
x: &TraceRef,
indices: &TraceRef,
dims: &GatherDims,
sizes: &[usize],
mode: GatherScatterMode,
sorted_unique: bool,
) -> TraceRef
fn gather<T: Element, I: Element>( x: &TraceRef, indices: &TraceRef, dims: &GatherDims, sizes: &[usize], mode: GatherScatterMode, sorted_unique: bool, ) -> TraceRef
gather.Source§fn scatter<T: Element, I: Element>(
combine: Option<BinaryOp>,
x: &TraceRef,
indices: &TraceRef,
updates: &TraceRef,
dims: &ScatterDims,
mode: GatherScatterMode,
sorted_unique: bool,
) -> TraceRef
fn scatter<T: Element, I: Element>( combine: Option<BinaryOp>, x: &TraceRef, indices: &TraceRef, updates: &TraceRef, dims: &ScatterDims, mode: GatherScatterMode, sorted_unique: bool, ) -> TraceRef
A scatter: replaces (
combine is None) or combines updates.Source§fn cond<S: Tree<Self>, R: Tree<Self>>(
index: I32<Trace>,
branches: &[&dyn Fn(S) -> R],
operand: S,
) -> R
fn cond<S: Tree<Self>, R: Tree<Self>>( index: I32<Trace>, branches: &[&dyn Fn(S) -> R], operand: S, ) -> R
Calls
branches[index] on operand; an index out of range calls the
last branch, as stablehlo.case does.Source§fn while_loop<C: Tree<Self>>(
cond: &dyn Fn(&C) -> Bool<Trace>,
body: &dyn Fn(C) -> C,
init: C,
) -> C
fn while_loop<C: Tree<Self>>( cond: &dyn Fn(&C) -> Bool<Trace>, body: &dyn Fn(C) -> C, init: C, ) -> C
Repeats
body while cond holds.Source§fn custom_jvp<I: Tree<Self>, O: Tree<Self>>(
f: &dyn Fn(I) -> O,
jvp: &dyn Fn(I, I) -> (O, O),
primals: I,
) -> O
fn custom_jvp<I: Tree<Self>, O: Tree<Self>>( f: &dyn Fn(I) -> O, jvp: &dyn Fn(I, I) -> (O, O), primals: I, ) -> O
Source§fn custom_vjp<I: Tree<Self>, O: Tree<Self>, R: Tree<Self>>(
f: &dyn Fn(I) -> O,
fwd: &dyn Fn(I) -> (O, R),
bwd: &dyn Fn(R, O) -> I,
primals: I,
) -> O
fn custom_vjp<I: Tree<Self>, O: Tree<Self>, R: Tree<Self>>( f: &dyn Fn(I) -> O, fwd: &dyn Fn(I) -> (O, R), bwd: &dyn Fn(R, O) -> I, primals: I, ) -> O
Source§fn checkpoint<I: Tree<Self>, O: Tree<Self>>(f: &dyn Fn(I) -> O, input: I) -> O
fn checkpoint<I: Tree<Self>, O: Tree<Self>>(f: &dyn Fn(I) -> O, input: I) -> O
f(input), whose intermediate values reverse mode recomputes (see
lax::checkpoint).Source§fn scan<C: Tree<Self>, X: Tree<Self>, Y: Tree<Self>>(
f: &dyn Fn(C, X) -> (C, Y),
init: C,
xs: X,
length: usize,
reverse: bool,
) -> (C, Y)
fn scan<C: Tree<Self>, X: Tree<Self>, Y: Tree<Self>>( f: &dyn Fn(C, X) -> (C, Y), init: C, xs: X, length: usize, reverse: bool, ) -> (C, Y)
A loop over the leading dimension of the arrays of
xs.Source§fn fori_loop<C: Tree<Self>>(
lo: I32<Trace>,
hi: I32<Trace>,
body: &dyn Fn(I32<Trace>, C) -> C,
init: C,
) -> C
fn fori_loop<C: Tree<Self>>( lo: I32<Trace>, hi: I32<Trace>, body: &dyn Fn(I32<Trace>, C) -> C, init: C, ) -> C
for i in lo..hi { state = body(i, state) }.Source§fn host_callback(
callback: &HostCallback,
args: &[TraceRef],
outputs: &[AVal],
) -> Vec<TraceRef>
fn host_callback( callback: &HostCallback, args: &[TraceRef], outputs: &[AVal], ) -> Vec<TraceRef>
host_callback: callback on the leaves args, whose results have
the types outputs.impl Copy for Trace
impl Eq for Trace
impl StructuralPartialEq for Trace
Auto Trait Implementations§
impl Freeze for Trace
impl RefUnwindSafe for Trace
impl Send for Trace
impl Sync for Trace
impl Unpin for Trace
impl UnsafeUnpin for Trace
impl UnwindSafe for Trace
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