code: def test_mlp(getkey):
      mlp = eqx.nn.MLP(2, 3, 8, 2, key=getkey())
      x = jrandom.normal(getkey(), (2,))
      assert mlp(x).shape == (3,)
  
      mlp = eqx.nn.MLP(
          in_size=2, out_size=3, width_size=8, depth=2, key=getkey()
      )
      x = jrandom.normal(getkey(), (2,))
      assert mlp(x).shape == (3,)
  
      mlp = eqx.nn.MLP("scalar", 2, 2, 2, key=getkey())
      x = jrandom.normal(getkey(), ())
      assert mlp(x).shape == (2,)
  
      mlp = eqx.nn.MLP(2, "scalar", 2, 2, key=getkey())
      x = jrandom.normal(getkey(), (2,))
      assert mlp(x).shape == ()
      assert [mlp.layers[i].use_bias for i in range(0, 3)] == [
          True,
          True,
          True,
      ]
  
      mlp = eqx.nn.MLP(
          2, 3, 8, 2, use_bias=False, use_final_bias=True, key=getkey()
      )
      x = jrandom.normal(getkey(), (2,))
      assert mlp(x).shape == (3,)
      assert [mlp.layers[i].use_bias for i in range(0, 3)] == [
          False,
          False,
          True,
      ]
  
      mlp = eqx.nn.MLP(
          2, 3, 8, 2, use_bias=True, use_final_bias=False, key=getkey()
      )
      x = jrandom.normal(getkey(), (2,))
      assert mlp(x).shape == (3,)
      assert [mlp.layers[i].use_bias for i in range(0, 3)] == [
          True,
          True,
          False,
      ]
  
imports: import warnings
  from typing import Union
  import equinox
  import jax
  import jax.nn
  import jax.numpy
  import jax.random
  import pytest
label_desc: Use image node_id 11 for calling a global function with example usage: test_mlp(getkey) without return types