code: def test_access_deep_layers_weights_and_losses(self):
      net = GnarlyNetwork()
      net.create_variables(training=True)
      layer_names = sorted([l.name for l in net.layers])
      losses = net.losses
      trainable_weight_names = sorted(
          [w.name for w in net.trainable_weights]
      )
      non_trainable_weight_names = sorted(
          [w.name for w in net.non_trainable_weights]
      )
      self.assertEqual(layer_names, ["a", "b"])
      self.assertLen(losses, 2)
      for loss in losses:
          self.assertEqual(loss.dtype, tf.float32)
          self.assertEqual(loss.shape, ())
      self.assertEqual(
          [x.lstrip("gnarly_network/") for x in trainable_weight_names],
          [
              "batch_normalization/beta:0",
              "batch_normalization/gamma:0",
              "dense/bias:0",
              "dense/kernel:0",
              "dense_1/bias:0",
              "dense_1/kernel:0",
              "b/bias:0",
              "b/kernel:0",
          ],
      )
      self.assertEqual(
          [
              x.lstrip("gnarly_network/")
              for x in non_trainable_weight_names
          ],
          [
              "batch_normalization/moving_mean:0",
              "batch_normalization/moving_variance:0",
          ],
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import parameterized
  import tensorflow
  import tensorflow_probability
  from tf_agents import specs
  from tf_agents.distributions import utils
  from tf_agents.keras_layers import rnn_wrapper
  from tf_agents.networks import network
  from tf_agents.utils import common
label_desc: Use image node_id 8 for calling the NetworkTest obj's underlying member method code with example usage: obj.test_access_deep_layers_weights_and_losses() without return types