MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / rename_axis

Function rename_axis

tensorflow/contrib/labeled_tensor/python/ops/ops.py:378–399  ·  view source on GitHub ↗

Rename an axis of LabeledTensor. Args: labeled_tensor: The input tensor. existing_name: Name for an existing axis on the input. new_name: Desired replacement name. name: Optional op name. Returns: LabeledTensor with renamed axis. Raises: ValueError: If `existing_name

(labeled_tensor, existing_name, new_name, name=None)

Source from the content-addressed store, hash-verified

376@tc.accepts(core.LabeledTensorLike, string_types, string_types,
377 tc.Optional(string_types))
378def rename_axis(labeled_tensor, existing_name, new_name, name=None):
379 """Rename an axis of LabeledTensor.
380
381 Args:
382 labeled_tensor: The input tensor.
383 existing_name: Name for an existing axis on the input.
384 new_name: Desired replacement name.
385 name: Optional op name.
386
387 Returns:
388 LabeledTensor with renamed axis.
389
390 Raises:
391 ValueError: If `existing_name` is not an axis on the input.
392 """
393 with ops.name_scope(name, 'lt_rename_axis', [labeled_tensor]) as scope:
394 if existing_name not in labeled_tensor.axes:
395 raise ValueError('existing_name %r are not contained in the set of axis '
396 'names %r on the input labeled tensor' %
397 (existing_name, labeled_tensor.axes.keys()))
398 new_axis = core.Axis(new_name, labeled_tensor.axes[existing_name].value)
399 return reshape(labeled_tensor, [existing_name], [new_axis], name=scope)
400
401
402@tc.returns(tc.List(core.LabeledTensor))

Callers

nothing calls this directly

Calls 3

reshapeFunction · 0.70
name_scopeMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected