code: def with_reshape(layer: Model[OutT, OutT]) -> Model[InT, InT]:
      """Reshape data on the way into and out from a layer."""
      return Model(
          f"with_reshape({layer.name})",
          forward,
          init=init,
          layers=[layer],
          dims={"nO": None, "nI": None},
      )
  
imports: from typing import Callable, List, Optional, Tuple, TypeVar, cast
  from ..config import registry
  from ..model import Model
  from ..types import Array2d, Array3d
label_desc: Use image node_id 1 for calling a global function with example usage: with_reshape(layer) and returns: Model