Attend the Women in ML Symposium on December 7 Register now


Stay organized with collections Save and categorize content based on your preferences.

Utility functions for TensorShape.


as_list(...): Returns a list of integers or None for each dimension.

assert_has_rank(...): Raises an exception if x is not compatible with the given rank.

assert_is_compatible_with(...): Raises exception if x and other do not represent the same shape.

concatenate(...): Returns the concatenation of the dimension in x and other.

constant_value_as_shape(...): A version of constant_value() that returns a TensorShape.

dims(...): Returns a list of dimension sizes, or None if rank is unknown.

is_compatible_with(...): Returns True iff x is compatible with other.

is_fully_defined(...): Returns True iff x is fully defined in every dimension.

merge_with(...): Returns a shape combining the information in x and other.

num_elements(...): Returns the total number of elements, or None for incomplete shapes.

rank(...): Returns the rank implied by this shape, or None if it is unspecified.

set_shape(...): Updates the shape of this tensor.

with_rank(...): Returns a shape based on x with the given rank.

with_rank_at_least(...): Returns a shape based on x with at least the given rank.