Freezes the InfeedQueue so it can no longer be modified. The configuration is implicitly frozen before any host-side or device-side Ops are generated. The configuration cannot be frozen until the types and shapes of the tuple elements have been set. Raises: ValueError: if the
(self)
| 432 | self.set_tuple_types([t.dtype for t in input_tensors[0]]) |
| 433 | |
| 434 | def freeze(self): |
| 435 | """Freezes the InfeedQueue so it can no longer be modified. |
| 436 | |
| 437 | The configuration is implicitly frozen before any host-side or |
| 438 | device-side Ops are generated. The configuration cannot be frozen |
| 439 | until the types and shapes of the tuple elements have been set. |
| 440 | |
| 441 | Raises: |
| 442 | ValueError: if the types or shapes of the tuple elements have not been |
| 443 | set. |
| 444 | """ |
| 445 | self._frozen = True |
| 446 | if self._tuple_types is None: |
| 447 | raise ValueError( |
| 448 | "Can't freeze an InfeedQueue without setting all tuple types.") |
| 449 | if self._tuple_shapes is None: |
| 450 | raise ValueError( |
| 451 | "Can't freeze an InfeedQueue without setting all tuple shapes.") |
| 452 | for shape in self._tuple_shapes: |
| 453 | if shape.dims is None: |
| 454 | raise ValueError( |
| 455 | "Can't freeze an InfeedQueue without setting all tuple shapes.") |
| 456 | for policy in self._sharding_policies: |
| 457 | policy.freeze() |
| 458 | self._validate() |
| 459 | |
| 460 | def generate_dequeue_op(self, tpu_device=0): |
| 461 | """Generates the device-side Op to dequeue a tuple from the queue. |