Skip to main content

Params

Enum Params 

Source
#[non_exhaustive]
pub enum Params {
Show 47 variants None, Convert { new_dtype: DType, }, Round { method: RoundingMethod, }, IntegerPow { y: i32, }, BroadcastInDim { shape: Shape, broadcast_dimensions: Vec<usize>, }, Reshape { new_sizes: Shape, }, Transpose { permutation: Vec<usize>, }, Reduce { axes: Vec<usize>, }, ArgMinMax { axis: usize, index_dtype: DType, }, DotGeneral { dimension_numbers: DotDims, precision: Precision, preferred_element_type: Option<DType>, }, ConvGeneralDilated { window_strides: Vec<usize>, padding: Vec<(i64, i64)>, lhs_dilation: Vec<usize>, rhs_dilation: Vec<usize>, dimension_numbers: ConvDims, feature_group_count: usize, batch_group_count: usize, precision: Precision, preferred_element_type: Option<DType>, }, ReduceWindow { window_dimensions: Vec<usize>, window_strides: Vec<usize>, padding: Vec<(i64, i64)>, base_dilation: Vec<usize>, window_dilation: Vec<usize>, }, SelectAndScatterAdd { select_prim: SelectPrim, window_dimensions: Vec<usize>, window_strides: Vec<usize>, padding: Vec<(i64, i64)>, }, SelectAndGatherAdd { select_prim: SelectPrim, window_dimensions: Vec<usize>, window_strides: Vec<usize>, padding: Vec<(i64, i64)>, base_dilation: Vec<usize>, window_dilation: Vec<usize>, }, Iota { dtype: DType, shape: Shape, dimension: usize, }, Slice { start_indices: Vec<usize>, limit_indices: Vec<usize>, strides: Vec<usize>, }, DynamicSlice { slice_sizes: Vec<usize>, }, Concatenate { dimension: usize, }, Pad { padding_config: Vec<(i64, i64, usize)>, }, Rev { dimensions: Vec<usize>, }, Sort { dimension: usize, is_stable: bool, num_keys: usize, }, Cumulative { axis: usize, reverse: bool, }, Fft { fft_type: FftType, fft_lengths: Vec<usize>, }, TopK { k: usize, axis: usize, is_stable: bool, }, TriangularSolve { left_side: bool, lower: bool, transpose_a: bool, conjugate_a: bool, unit_diagonal: bool, }, LuPivotsToPermutation { permutation_size: usize, }, Qr { full_matrices: bool, pivoting: bool, }, Eigh { lower: bool, sort_eigenvalues: bool, subset_by_index: Option<(usize, usize)>, algorithm: Option<EighImplementation>, }, Schur { compute_schur_vectors: bool, }, Ormqr { left: bool, transpose: bool, }, SymmetricProduct { alpha: f64, beta: f64, }, Tridiagonal { lower: bool, }, HostCallback { callback: HostCallback, outputs: Vec<AVal>, }, TridiagonalSolve { perturb_singular: bool, }, Eig { compute_left_eigenvectors: bool, compute_right_eigenvectors: bool, enable_eigvec_derivs: bool, }, Svd { full_matrices: bool, compute_uv: bool, subset_by_index: Option<(usize, usize)>, algorithm: Option<SvdAlgorithm>, }, Gather { dimension_numbers: GatherDims, slice_sizes: Vec<usize>, mode: GatherScatterMode, indices_are_sorted: bool, unique_indices: bool, }, Scatter { dimension_numbers: ScatterDims, mode: GatherScatterMode, indices_are_sorted: bool, unique_indices: bool, }, Cond { branches: Vec<Arc<Function>>, }, While { cond: Arc<Function>, body: Arc<Function>, cond_nconsts: usize, body_nconsts: usize, }, Scan { body: Arc<Function>, length: usize, reverse: bool, num_consts: usize, num_carry: usize, }, Jit { name: String, body: Arc<Function>, }, CustomJvp { call: Arc<Function>, jvp: Arc<Function>, num_consts: usize, }, CustomVjp { call: Arc<Function>, fwd: Arc<Function>, bwd: Arc<Function>, num_consts: usize, }, CustomLin { bwd: Arc<Function>, num_res: usize, }, Checkpoint { body: Arc<Function>, }, Extern { name: String, module: Arc<str>, inputs: Vec<AVal>, outputs: Vec<AVal>, },
}
Expand description

The parameters of an equation, one variant per family of primitives.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

None

No parameters.

§

Convert

convert_element_type and bitcast_convert_type.

Fields

§new_dtype: DType

The type to convert to.

§

Round

round.

Fields

§method: RoundingMethod

How halfway cases are rounded.

§

IntegerPow

integer_pow.

Fields

§y: i32

The exponent.

§

BroadcastInDim

broadcast_in_dim.

Fields

§shape: Shape

The shape of the result.

§broadcast_dimensions: Vec<usize>

For each operand dimension, the result dimension it becomes.

§

Reshape

reshape.

Fields

§new_sizes: Shape

The shape of the result.

§

Transpose

transpose.

Fields

§permutation: Vec<usize>

The operand dimension of each result dimension.

§

Reduce

reduce_sum, reduce_max, reduce_min.

Fields

§axes: Vec<usize>

The dimensions to reduce.

§

ArgMinMax

argmax, argmin.

Fields

§axis: usize

The dimension to reduce.

§index_dtype: DType

The type of the indices.

§

DotGeneral

dot_general.

Fields

§dimension_numbers: DotDims

The contracting and batch dimensions.

§precision: Precision

The precision on accelerators.

§preferred_element_type: Option<DType>

The type of the result, if it differs from the operands.

§

ConvGeneralDilated

conv_general_dilated.

Fields

§window_strides: Vec<usize>

The step between windows in each spatial dimension.

§padding: Vec<(i64, i64)>

(low, high) padding of each spatial dimension of the (dilated) input; negative padding removes elements.

§lhs_dilation: Vec<usize>

The dilation of each spatial dimension of the input.

§rhs_dilation: Vec<usize>

The dilation of each spatial dimension of the kernel.

§dimension_numbers: ConvDims

The layout of the operands and the result.

§feature_group_count: usize

The number of groups of input and output features.

§batch_group_count: usize

The number of groups of the batch (as output feature groups).

§precision: Precision

The precision on accelerators.

§preferred_element_type: Option<DType>

The type of the result, if it differs from the operands.

§

ReduceWindow

reduce_window_sum, reduce_window_max, reduce_window_min.

Fields

§window_dimensions: Vec<usize>

The size of the window in each dimension.

§window_strides: Vec<usize>

The step between windows in each dimension.

§padding: Vec<(i64, i64)>

(low, high) padding of each dimension of the (dilated) operand.

§base_dilation: Vec<usize>

The dilation of the operand.

§window_dilation: Vec<usize>

The dilation of the window.

§

SelectAndScatterAdd

select_and_scatter_add.

Fields

§select_prim: SelectPrim

How elements are selected in each window.

§window_dimensions: Vec<usize>

The size of the window in each dimension.

§window_strides: Vec<usize>

The step between windows in each dimension.

§padding: Vec<(i64, i64)>

(low, high) padding of each dimension of the operand.

§

SelectAndGatherAdd

select_and_gather_add.

Fields

§select_prim: SelectPrim

How elements are selected in each window.

§window_dimensions: Vec<usize>

The size of the window in each dimension.

§window_strides: Vec<usize>

The step between windows in each dimension.

§padding: Vec<(i64, i64)>

(low, high) padding of each dimension of the (dilated) operand.

§base_dilation: Vec<usize>

The dilation of the operand.

§window_dilation: Vec<usize>

The dilation of the window.

§

Iota

iota.

Fields

§dtype: DType

The type of the result.

§shape: Shape

The shape of the result.

§dimension: usize

The dimension along which values increase.

§

Slice

slice.

Fields

§start_indices: Vec<usize>

The first index of each dimension.

§limit_indices: Vec<usize>

One past the last index of each dimension.

§strides: Vec<usize>

The step of each dimension.

§

DynamicSlice

dynamic_slice.

Fields

§slice_sizes: Vec<usize>

The size of the slice in each dimension.

§

Concatenate

concatenate.

Fields

§dimension: usize

The dimension to join along.

§

Pad

pad.

Fields

§padding_config: Vec<(i64, i64, usize)>

(low, high, interior) padding of each dimension.

§

Rev

rev.

Fields

§dimensions: Vec<usize>

The dimensions to reverse.

§

Sort

sort.

Fields

§dimension: usize

The dimension to sort along.

§is_stable: bool

Whether equal keys keep their order.

§num_keys: usize

The number of leading operands that are keys, compared lexicographically.

§

Cumulative

cumsum, cumprod, cummax, cummin, and cumlogsumexp.

Fields

§axis: usize

The dimension to accumulate along.

§reverse: bool

Whether to accumulate from the end.

§

Fft

fft.

Fields

§fft_type: FftType

The kind of transform.

§fft_lengths: Vec<usize>

The lengths of the transformed (trailing) axes of the result (of the operand, except the last for Irfft).

§

TopK

top_k.

Fields

§k: usize

The number of largest elements to return.

§axis: usize

The dimension to search along.

§is_stable: bool

Whether equal elements keep their order.

§

TriangularSolve

triangular_solve.

Fields

§left_side: bool

Solve op(a) x = b if true, x op(a) = b if false.

§lower: bool

Use the lower triangle of a if true, the upper if false.

§transpose_a: bool

op(a) transposes a.

§conjugate_a: bool

op(a) conjugates a (no effect for real numbers).

§unit_diagonal: bool

The diagonal of a is taken to be ones (and not read).

§

LuPivotsToPermutation

lu_pivots_to_permutation.

Fields

§permutation_size: usize

The size of the permutation (at least the number of pivots).

§

Qr

qr.

Fields

§full_matrices: bool

q is square (m x m) if true, m x min(m, n) if false.

§pivoting: bool

Column pivoting (not supported yet; always false).

§

Eigh

eigh.

Fields

§lower: bool

Read the lower triangle of the operand if true, the upper if false.

§sort_eigenvalues: bool

Whether the eigenvalues must be sorted in ascending order (they always are).

§subset_by_index: Option<(usize, usize)>

The range [start, end) of the (ascending) eigenvalues and their eigenvectors that are returned (all if None).

§algorithm: Option<EighImplementation>

The algorithm (the platform’s default if None).

§

Schur

schur: the Schur decomposition.

Fields

§compute_schur_vectors: bool

Whether the Schur vectors are computed.

§

Ormqr

ormqr: the product with Q of Householder reflectors.

Fields

§left: bool

Q c if true, c Q if false.

§transpose: bool

Q^H in place of Q.

§

SymmetricProduct

symmetric_product: alpha a a^T + beta c.

Fields

§alpha: f64

The factor of a a^T.

§beta: f64

The factor of c.

§

Tridiagonal

tridiagonal: the reduction of Hermitian matrices to tridiagonal form.

Fields

§lower: bool

Whether the lower triangle is read (otherwise the upper one).

§

HostCallback

host_callback: a Rust function on host arrays.

Fields

§callback: HostCallback

The function.

§outputs: Vec<AVal>

The types of the results.

§

TridiagonalSolve

tridiagonal_solve: the solution of tridiagonal systems.

Fields

§perturb_singular: bool

Whether tiny pivots are perturbed so that numerically singular systems give finite solutions.

§

Eig

eig: the eigendecomposition of general matrices.

Fields

§compute_left_eigenvectors: bool

Whether the left eigenvectors are computed.

§compute_right_eigenvectors: bool

Whether the right eigenvectors are computed.

§enable_eigvec_derivs: bool

Whether the eigenvectors are differentiable (JAX’s opt-in: the derivatives hold for distinct eigenvalues only).

§

Svd

svd.

Fields

§full_matrices: bool

u and vt are square if true, m x k and k x n if false.

§compute_uv: bool

Whether u and vt are computed (otherwise only the singular values are returned).

§subset_by_index: Option<(usize, usize)>

The range [start, end) of the (descending) singular values and their vectors that are returned (all if None).

§algorithm: Option<SvdAlgorithm>

The algorithm (the platform’s default if None).

§

Gather

gather.

Fields

§dimension_numbers: GatherDims

How indices and slices map to the result.

§slice_sizes: Vec<usize>

The size of the slice in each operand dimension.

§mode: GatherScatterMode

How out-of-bounds indices are treated.

§indices_are_sorted: bool

Whether the indices are sorted (a hint).

§unique_indices: bool

Whether the indices are unique (a hint).

§

Scatter

The scatter family.

Fields

§dimension_numbers: ScatterDims

How indices and updates map to the operand.

§mode: GatherScatterMode

How out-of-bounds indices are treated.

§indices_are_sorted: bool

Whether the indices are sorted (a hint).

§unique_indices: bool

Whether the indices are unique (a hint).

§

Cond

cond: calls the branch chosen by an index.

Fields

§branches: Vec<Arc<Function>>

The branches, which take and return the same types.

§

While

while: repeats the body while the predicate holds.

Fields

§cond: Arc<Function>

Takes cond_nconsts constants and the carry; returns a bool.

§body: Arc<Function>

Takes body_nconsts constants and the carry; returns the carry.

§cond_nconsts: usize

The number of constants of the predicate.

§body_nconsts: usize

The number of constants of the body.

§

Scan

scan: a loop over the leading dimension of some inputs.

Fields

§body: Arc<Function>

Takes constants, the carry, and slices of the scanned inputs; returns the carry and slices of the outputs.

§length: usize

The number of iterations.

§reverse: bool

Whether to iterate from the end.

§num_consts: usize

The number of constants.

§num_carry: usize

The number of carried values.

§

Jit

jit: a call to a function compiled as a unit.

Fields

§name: String

The name, for display.

§body: Arc<Function>

The function.

§

CustomJvp

custom_jvp_call: a function with a JVP rule written by the user (jax.custom_jvp).

Fields

§call: Arc<Function>

Takes the constants and the arguments; returns the outputs.

§jvp: Arc<Function>

Takes the constants, the arguments, and a tangent for each argument; returns the outputs and a tangent for each output.

§num_consts: usize

The number of constants (values the function captured, which are not differentiated).

§

CustomVjp

custom_vjp_call: a function with a VJP rule written by the user (jax.custom_vjp).

Fields

§call: Arc<Function>

Takes the constants and the arguments; returns the outputs.

§fwd: Arc<Function>

Takes the constants and the arguments; returns the outputs and the residuals.

§bwd: Arc<Function>

Takes the residuals and a cotangent for each output; returns a cotangent for each argument.

§num_consts: usize

The number of constants (not differentiated).

§

CustomLin

custom_lin: the linear part of a custom_vjp_call in forward mode, which only reverse mode can use (it is transposed into bwd).

Fields

§bwd: Arc<Function>

The backward function of the custom_vjp_call.

§num_res: usize

The number of residuals (the first inputs).

§

Checkpoint

checkpoint: a function whose intermediate values are recomputed in reverse mode instead of stored (jax.checkpoint).

Fields

§body: Arc<Function>

The function.

§

Extern

extern_call: a call to the public main of a StableHLO module written by another program (such as jax.export), which XLA links with the caller.

Fields

§name: String

The name, for display and for the symbols of the linked module.

§module: Arc<str>

The module, in the MLIR text format.

§inputs: Vec<AVal>

The types of the inputs of main.

§outputs: Vec<AVal>

The types of the outputs of main.

Implementations§

Source§

impl Params

Source

pub fn functions(&self) -> Vec<&Function>

Returns the functions nested in the parameters.

Trait Implementations§

Source§

impl Clone for Params

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Params

Source§

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

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

impl PartialEq for Params

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Params

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.