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

Function broadcast_shape

tensorflow/python/framework/common_shapes.py:578–597  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

576
577
578def 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
600def call_cpp_shape_fn(op, require_shape_fn=True):

Callers

nothing calls this directly

Calls 2

_broadcast_shape_helperFunction · 0.85
unknown_shapeMethod · 0.80

Tested by

no test coverage detected