class_docstr: Tests KerasLayer in an all-Keras environment.
class_docstr_tok: ["Tests","KerasLayer","in","an","all-Keras","environment","."]
docstr: Tests custom attributes (Asset and Variable) on a SavedModel.
docstr_tok: ["Tests","custom","attributes","(","Asset","and","Variable",")","on","a","SavedModel","."]
code: def testCustomAttributes(self, save_from_keras):
      """Tests custom attributes (Asset and Variable) on a SavedModel."""
      _skip_if_no_tf_asset(self)
      base_dir = os.path.join(self.get_temp_dir(), "custom-attributes")
      export_dir = os.path.join(base_dir, "model")
      temp_dir = os.path.join(base_dir, "scratch")
      _save_model_with_custom_attributes(
          export_dir, temp_dir, save_from_keras=save_from_keras
      )
      imported = hub.KerasLayer(export_dir)
      expected_outputs = (
          imported.resolved_object.sample_output.value().numpy()
      )
      asset_path = (
          imported.resolved_object.sample_input.asset_path.numpy()
      )
      with tf.io.gfile.GFile(asset_path) as f:
          inputs = tf.constant([[f.read()]], dtype=tf.string)
      actual_outputs = imported(inputs).numpy()
      self.assertAllEqual(expected_outputs, actual_outputs)
  
imports: import json
  import os
  from absl.testing import parameterized
  import numpy
  import tensorflow
  import tensorflow_hub
label_desc: Use image node_id 5 for calling the KerasTest obj's underlying member method code with example usage: obj.testCustomAttributes(save_from_keras) without return types