Evaluates this tensor in a `Session`. Calling this method will execute all preceding operations that produce the inputs needed for the operation that produces this tensor. *N.B.* Before invoking `Tensor.eval()`, its graph must have been launched in a session, and either a defau
(self, feed_dict=None, session=None)
| 775 | self._disallow_bool_casting() |
| 776 | |
| 777 | def eval(self, feed_dict=None, session=None): |
| 778 | """Evaluates this tensor in a `Session`. |
| 779 | |
| 780 | Calling this method will execute all preceding operations that |
| 781 | produce the inputs needed for the operation that produces this |
| 782 | tensor. |
| 783 | |
| 784 | *N.B.* Before invoking `Tensor.eval()`, its graph must have been |
| 785 | launched in a session, and either a default session must be |
| 786 | available, or `session` must be specified explicitly. |
| 787 | |
| 788 | Args: |
| 789 | feed_dict: A dictionary that maps `Tensor` objects to feed values. See |
| 790 | `tf.Session.run` for a description of the valid feed values. |
| 791 | session: (Optional.) The `Session` to be used to evaluate this tensor. If |
| 792 | none, the default session will be used. |
| 793 | |
| 794 | Returns: |
| 795 | A numpy array corresponding to the value of this tensor. |
| 796 | |
| 797 | """ |
| 798 | return _eval_using_default_session(self, feed_dict, self.graph, session) |
| 799 | |
| 800 | def experimental_ref(self): |
| 801 | # tf.Variable also has the same experimental_ref() API. If you update the |