class_docstr: Unit tests for KerasLayer.
class_docstr_tok: ["Unit","tests","for","KerasLayer","."]
code: def test_keras_layer_logs_if_training_zero_variables(self):
      path = os.path.join(self.get_temp_dir(), "zero-variables")
      _save_model_with_hparams(path)
      layer = hub.KerasLayer(path, trainable=True)
      if hasattr(self, "assertLogs"):  # New in Python 3.4.
          with self.assertLogs(level="ERROR") as logs:
              layer([[10.0]])
              layer([[10.0]])
          self.assertLen(
              logs.records, 1
          )  # Duplicate logging is avoided.
          self.assertRegexpMatches(
              logs.records[0].msg, "zero trainable weights"
          )
      else:
          # Just test that it runs at all.
          layer([[10.0]])
          layer([[10.0]])
  
imports: import json
  import os
  from absl.testing import parameterized
  import numpy
  import tensorflow
  import tensorflow_hub
label_desc: Use image node_id 11 for calling the KerasLayerTest obj's underlying member method code with example usage: obj.test_keras_layer_logs_if_training_zero_variables() without return types