parameters: (trackable_asset, asset_info, resource_map)
docstring: Add `trackable_asset` to `asset_info` and `resource_map`.
docstring_summary: Add `trackable_asset` to `asset_info` and `resource_map`.
docstring_tokens: Add trackable_asset to asset_info and resource_map .
function: def _process_asset(trackable_asset, asset_info, resource_map):
    """Add `trackable_asset` to `asset_info` and `resource_map`."""
    original_path_tensor = trackable_asset.asset_path
    original_path = tensor_util.constant_value(original_path_tensor)
    try:
      original_path = str(original_path.astype(str))
    except AttributeError:
      # Already a string rather than a numpy array
      pass
    path = builder_impl.get_asset_filename_to_add(
        asset_filepath=original_path,
        asset_filename_map=asset_info.asset_filename_map)
    # TODO(andresp): Instead of mapping 1-1 between trackable asset
    # and asset in the graph def consider deduping the assets that
    # point to the same file.
    asset_path_initializer = array_ops.placeholder(
        shape=original_path_tensor.shape,
        dtype=dtypes.string,
        name="asset_path_initializer")
    asset_variable = resource_variable_ops.ResourceVariable(
        asset_path_initializer)
    asset_info.asset_filename_map[path] = original_path
    asset_def = meta_graph_pb2.AssetFileDef()
    asset_def.filename = path
    asset_def.tensor_info.name = asset_path_initializer.name
    asset_info.asset_defs.append(asset_def)
    asset_info.asset_initializers_by_resource[original_path_tensor] = (
        asset_variable.initializer)
    asset_info.asset_index[trackable_asset] = len(asset_info.asset_defs) - 1
    resource_map[original_path_tensor] = asset_variable
function_tokens: def _process_asset ( trackable_asset , asset_info , resource_map ) : original_path_tensor = trackable_asset . asset_path original_path = tensor_util . constant_value ( original_path_tensor ) try : original_path = str ( original_path . astype ( str ) ) except AttributeError : # Already a string rather than a numpy array pass path = builder_impl . get_asset_filename_to_add ( asset_filepath = original_path , asset_filename_map = asset_info . asset_filename_map ) # TODO(andresp): Instead of mapping 1-1 between trackable asset # and asset in the graph def consider deduping the assets that # point to the same file. asset_path_initializer = array_ops . placeholder ( shape = original_path_tensor . shape , dtype = dtypes . string , name = "asset_path_initializer" ) asset_variable = resource_variable_ops . ResourceVariable ( asset_path_initializer ) asset_info . asset_filename_map [ path ] = original_path asset_def = meta_graph_pb2 . AssetFileDef ( ) asset_def . filename = path asset_def . tensor_info . name = asset_path_initializer . name asset_info . asset_defs . append ( asset_def ) asset_info . asset_initializers_by_resource [ original_path_tensor ] = ( asset_variable . initializer ) asset_info . asset_index [ trackable_asset ] = len ( asset_info . asset_defs ) - 1 resource_map [ original_path_tensor ] = asset_variable