Returns the `Tensor` with the given `name`. This method may be called concurrently from multiple threads. Args: name: The name of the `Tensor` to return. Returns: The `Tensor` with the given `name`. Raises: TypeError: If `name` is not a string. KeyError: I
(self, name)
| 3773 | return self._get_operation_by_name_unsafe(op_name) |
| 3774 | |
| 3775 | def get_tensor_by_name(self, name): |
| 3776 | """Returns the `Tensor` with the given `name`. |
| 3777 | |
| 3778 | This method may be called concurrently from multiple threads. |
| 3779 | |
| 3780 | Args: |
| 3781 | name: The name of the `Tensor` to return. |
| 3782 | |
| 3783 | Returns: |
| 3784 | The `Tensor` with the given `name`. |
| 3785 | |
| 3786 | Raises: |
| 3787 | TypeError: If `name` is not a string. |
| 3788 | KeyError: If `name` does not correspond to a tensor in this graph. |
| 3789 | """ |
| 3790 | # Names should be strings. |
| 3791 | if not isinstance(name, six.string_types): |
| 3792 | raise TypeError("Tensor names are strings (or similar), not %s." % |
| 3793 | type(name).__name__) |
| 3794 | return self.as_graph_element(name, allow_tensor=True, allow_operation=False) |
| 3795 | |
| 3796 | def _get_tensor_by_tf_output(self, tf_output): |
| 3797 | """Returns the `Tensor` representing `tf_output`. |