[][src]Crate ndarray_einsum_beta

The ndarray_einsum crate implements the einsum function, originally implemented for numpy by Mark Wiebe and subsequently reimplemented for other tensor libraries such as Tensorflow and PyTorch. einsum (Einstein summation) implements general multidimensional tensor contraction. Many linear algebra operations and generalizations of those operations can be expressed as special cases of tensor contraction. Examples include matrix multiplication, matrix trace, vector dot product, tensor Hadamard [element-wise] product, axis permutation, outer product, batch matrix multiplication, bilinear transformations, and many more.

Modules

contractors
optimizers

Methods to produce a ContractionOrder, specifying what order in which to perform pairwise contractions between tensors in order to perform the full contraction.

slow_versions
validation
wasm_bindings

Structs

Contraction

A Contraction contains the result of parsing an einsum-formatted string.

PathContraction

A PathContraction, returned by einsum_path, represents a fully-prepared plan to perform a tensor contraction.

SizedContraction

A SizedContraction contains a Contraction as well as a HashMap<char, usize> specifying the axis lengths for each index in the contraction.

Enums

ContractionOrder

The order in which to contract pairs of tensors and the specific contractions to be performed between the pairs.

OptimizationMethod

Strategy for optimizing the contraction. The only currently supported options are "Naive" and "Reverse".

PathContractionSteps

Either a singleton contraction, in the case of a single input operand, or a list of pair contractions, given two or more input operands

Traits

ArrayLike
PathContractor

Functions

einsum
einsum_path
einsum_sc
generate_optimized_order

Given a SizedContraction and an optimization strategy, returns an order in which to perform pairwise contractions in order to produce the final result

slow_einsum
slow_einsum_given_sized_contraction
slow_einsum_with_flattened_operands_as_json_string_as_json
tensordot
validate

Wrapper around Contraction::new().

validate_and_optimize_order
validate_and_size

Wrapper around SizedContraction::new().

validate_and_size_from_shapes

Only included so the function can be called from WASM, i.e. without arguments that are already ndarray ArrayBases.

validate_and_size_from_shapes_as_string_as_json
validate_as_json