Learn R Programming

einops (version 0.2.1)

prepare_transformation_recipe: Create the Transformation Recipe for an einops call

Description

This function does the following parts of the einops 'compilation' pipeline:

  1. Lexing: tokenizing the input expression string

  2. Parsing: converting the tokens into an Abstract Syntax Tree (AST)

  3. Syntactic Analysis:

    • operation-based AST validation pass

    • Compile syntactic info for intermediate representation (IR).

  4. IR generation: return the TransformRecipe() object.

Usage

prepare_transformation_recipe(
  expr,
  func,
  axes_names,
  ndim,
  reverse_groups = FALSE
)

Value

a populated TransformRecipe() object

Arguments

expr

The input einops expression string

func

The string/function indicating the reduction operation

axes_names

user defined axis names as a character() vector.

ndim

count for the number of dimensions of the input tensor

reverse_groups

[Experimental] logical: whether to reverse the order of the axes in each group.