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

Method __iter__

tensorflow/python/framework/ops.py:545–558  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

543 self._disallow_in_graph_mode("iterating over `tf.Tensor`")
544
545 def __iter__(self):
546 if not context.executing_eagerly():
547 self._disallow_iteration()
548
549 shape = self._shape_tuple()
550 if shape is None:
551 raise TypeError("Cannot iterate over a tensor with unknown shape.")
552 if not shape:
553 raise TypeError("Cannot iterate over a scalar tensor.")
554 if shape[0] is None:
555 raise TypeError(
556 "Cannot iterate over a tensor with unknown first dimension.")
557 for i in xrange(shape[0]):
558 yield self[i]
559
560 def _shape_as_list(self):
561 if self.shape.ndims is not None:

Callers

nothing calls this directly

Calls 3

_disallow_iterationMethod · 0.95
_shape_tupleMethod · 0.95
executing_eagerlyMethod · 0.80

Tested by

no test coverage detected