code: def _to_array(x):
      if not isinstance(x, jax.Array):
          x = jnp.asarray(x)
      return x
  
file_path: flax/flax/experimental/nnx/examples/lm1b/utils.py
imports: import logging
  from typing import Any, Callable
  from typing_extensions import Protocol, runtime_checkable
  import jax
  import jax.numpy
  import numpy
  from jax.experimental import mesh_utils
  from flax.experimental.nnx.examples.lm1b.configs import default
  from models import TransformerConfig, TransformerLM
  from flax.experimental import nnx
  from flax.training import train_state
label_desc: Use image node_id 3 for calling a global function with example usage: _to_array(x) and returns: x