(self)
| 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: |
nothing calls this directly
no test coverage detected