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

Class Tensor

tensorflow/python/framework/ops.py:288–851  ·  view source on GitHub ↗

Represents one of the outputs of an `Operation`. A `Tensor` is a symbolic handle to one of the outputs of an `Operation`. It does not hold the values of that operation's output, but instead provides a means of computing those values in a TensorFlow `tf.compat.v1.Session`. This class has

Source from the content-addressed store, hash-verified

286
287@tf_export("Tensor")
288class Tensor(_TensorLike):
289 """Represents one of the outputs of an `Operation`.
290
291 A `Tensor` is a symbolic handle to one of the outputs of an
292 `Operation`. It does not hold the values of that operation's output,
293 but instead provides a means of computing those values in a
294 TensorFlow `tf.compat.v1.Session`.
295
296 This class has two primary purposes:
297
298 1. A `Tensor` can be passed as an input to another `Operation`.
299 This builds a dataflow connection between operations, which
300 enables TensorFlow to execute an entire `Graph` that represents a
301 large, multi-step computation.
302
303 2. After the graph has been launched in a session, the value of the
304 `Tensor` can be computed by passing it to
305 `tf.Session.run`.
306 `t.eval()` is a shortcut for calling
307 `tf.compat.v1.get_default_session().run(t)`.
308
309 In the following example, `c`, `d`, and `e` are symbolic `Tensor`
310 objects, whereas `result` is a numpy array that stores a concrete
311 value:
312
313 ```python
314 # Build a dataflow graph.
315 c = tf.constant([[1.0, 2.0], [3.0, 4.0]])
316 d = tf.constant([[1.0, 1.0], [0.0, 1.0]])
317 e = tf.matmul(c, d)
318
319 # Construct a `Session` to execute the graph.
320 sess = tf.compat.v1.Session()
321
322 # Execute the graph and store the value that `e` represents in `result`.
323 result = sess.run(e)
324 ```
325 """
326
327 # List of Python operators that we allow to override.
328 OVERLOADABLE_OPERATORS = {
329 # Binary.
330 "__add__",
331 "__radd__",
332 "__sub__",
333 "__rsub__",
334 "__mul__",
335 "__rmul__",
336 "__div__",
337 "__rdiv__",
338 "__truediv__",
339 "__rtruediv__",
340 "__floordiv__",
341 "__rfloordiv__",
342 "__mod__",
343 "__rmod__",
344 "__lt__",
345 "__le__",

Callers 3

__init__Method · 0.70
_add_outputsMethod · 0.70
PySeqToTensorFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected