prepare_transformation_recipe: Create the Transformation Recipe for an einops call

View source: R/compiler-TransformRecipe.R

prepare_transformation_recipeR Documentation

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
)

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.

Value

a populated TransformRecipe() object


einops documentation built on Sept. 9, 2025, 5:29 p.m.