code: def apply_for_scriptable_torch(
      recipe: TransformRecipe,
      tensor: torch.Tensor,
      reduction_type: str,
      axes_dims: List[Tuple[str, int]],
  ) -> torch.Tensor:
      backend = TorchJitBackend
      (
          init_shapes,
          axes_reordering,
          reduced_axes,
          added_axes,
          final_shapes,
          n_axes_w_added,
      ) = _reconstruct_from_shape_uncached(
          recipe, backend.shape(tensor), axes_dims=axes_dims
      )
      if init_shapes is not None:
          tensor = backend.reshape(tensor, init_shapes)
      if axes_reordering is not None:
          tensor = backend.transpose(tensor, axes_reordering)
      if len(reduced_axes) > 0:
          tensor = backend.reduce(
              tensor,
              operation=reduction_type,
              reduced_axes=reduced_axes,
          )
      if len(added_axes) > 0:
          tensor = backend.add_axes(
              tensor, n_axes=n_axes_w_added, pos2len=added_axes
          )
      if final_shapes is not None:
          tensor = backend.reshape(tensor, final_shapes)
      return tensor
  
file_path: einops/einops/_torch_specific.py
imports: import warnings
  from typing import Dict, List, Tuple
  import torch
  from einops.einops import TransformRecipe, _reconstruct_from_shape_uncached
label_desc: Use image node_id 1 for calling a global function with example usage: apply_for_scriptable_torch(recipe, tensor, reduction_type, axes_dims) and returns: tensor