tensorflow_serving/servables/tensorflow/testdata/saved_model_half_plus_two.py
def _create_asset_file(tf2=False):
  """Helper to create assets file. Returns a tensor for the filename."""
  # Create an assets file that can be saved and restored as part of the
  # SavedModel.
  original_assets_directory = "/tmp/original/export/assets"
  original_assets_filename = "foo.txt"
  original_assets_filepath = _write_assets(original_assets_directory,
                                           original_assets_filename)

  if tf2:
    return tf.saved_model.Asset(original_assets_filepath)

  # Set up the assets collection.
  assets_filepath = tf.constant(original_assets_filepath)
  tf.add_to_collection(tf.GraphKeys.ASSET_FILEPATHS, assets_filepath)
  filename_tensor = tf.Variable(
      original_assets_filename,
      name="filename_tensor",
      trainable=False,
      collections=[])
  return filename_tensor.assign(original_assets_filename)
Helper to create assets file. Returns a tensor for the filename.
Helper to create assets file. Returns a tensor for the filename.
Helper to create assets file . Returns a tensor for the filename .
def _create_asset_file(tf2=False):
  original_assets_directory = "/tmp/original/export/assets"
  original_assets_filename = "foo.txt"
  original_assets_filepath = _write_assets(original_assets_directory,
                                           original_assets_filename)
  if tf2:
    return tf.saved_model.Asset(original_assets_filepath)
  assets_filepath = tf.constant(original_assets_filepath)
  tf.add_to_collection(tf.GraphKeys.ASSET_FILEPATHS, assets_filepath)
  filename_tensor = tf.Variable(
      original_assets_filename,
      name="filename_tensor",
      trainable=False,
      collections=[])
  return filename_tensor.assign(original_assets_filename)
def _create_asset_file ( tf2 = False ) : original_assets_directory = "/tmp/original/export/assets" original_assets_filename = "foo.txt" original_assets_filepath = _write_assets ( original_assets_directory , original_assets_filename ) if tf2 : return tf . saved_model . Asset ( original_assets_filepath ) assets_filepath = tf . constant ( original_assets_filepath ) tf . add_to_collection ( tf . GraphKeys . ASSET_FILEPATHS , assets_filepath ) filename_tensor = tf . Variable ( original_assets_filename , name = "filename_tensor" , trainable = False , collections = [ ] ) return filename_tensor . assign ( original_assets_filename )
Helper to create assets file.
Helper to create assets file .
"""Helper to create assets file. Returns a tensor for the filename.""" # Create an assets file that can be saved and restored as part of the # SavedModel. # Set up the assets collection.
tf2