class_docstr: Tests for utilities in nn_ops.py.
class_docstr_tok: ["Tests","for","utilities","in","nn_ops.py","."]
docstr: Tests truncated_normal_initializer.
docstr_tok: ["Tests","truncated_normal_initializer","."]
code: def test_truncated_normal_init(self):
      """Tests truncated_normal_initializer."""
      target_stddev = 0.4
      key = jax.random.PRNGKey(42)
      shape = (128, 128, 128)
      init_fn = nn_ops.truncated_normal_initializer(
          stddev=target_stddev
      )
      x = init_fn(key, shape, jnp.float32)
      self.assertAlmostEqual(target_stddev, jnp.std(x), places=2)
  
imports: import functools
  from absl.testing import absltest
  from absl.testing import parameterized
  import flax.linen
  import jax
  import jax.numpy
  import numpy
  from scenic.model_lib.layers import nn_ops
label_desc: Use image node_id 12 for calling the NNOpsTest obj's underlying member method code with example usage: obj.test_truncated_normal_init() without return types