Returns the broadcasted shape between `shape_x` and `shape_y`. Args: shape_x: A `TensorShape` shape_y: A `TensorShape` Returns: A `TensorShape` representing the broadcasted shape. Raises: ValueError: If the two shapes can not be broadcasted.
(shape_x, shape_y)
| 576 | |
| 577 | |
| 578 | def broadcast_shape(shape_x, shape_y): |
| 579 | """Returns the broadcasted shape between `shape_x` and `shape_y`. |
| 580 | |
| 581 | Args: |
| 582 | shape_x: A `TensorShape` |
| 583 | shape_y: A `TensorShape` |
| 584 | |
| 585 | Returns: |
| 586 | A `TensorShape` representing the broadcasted shape. |
| 587 | |
| 588 | Raises: |
| 589 | ValueError: If the two shapes can not be broadcasted. |
| 590 | """ |
| 591 | if shape_x.ndims is None or shape_y.ndims is None: |
| 592 | return tensor_shape.unknown_shape() |
| 593 | return_dims = _broadcast_shape_helper(shape_x, shape_y) |
| 594 | if return_dims is None: |
| 595 | raise ValueError("Incompatible shapes for broadcasting: %s and %s" |
| 596 | % (shape_x, shape_y)) |
| 597 | return tensor_shape.TensorShape(return_dims) |
| 598 | |
| 599 | |
| 600 | def call_cpp_shape_fn(op, require_shape_fn=True): |
nothing calls this directly
no test coverage detected