Returns the rank (number of dimensions) of the given shape. Shape must be an array.
| 49 | // Returns the rank (number of dimensions) of the given shape. Shape must be |
| 50 | // an array. |
| 51 | int64 rank() const { |
| 52 | CHECK(IsArray()) << "Non-arrays do not have a rank, shape: " << ToString(); |
| 53 | return dimensions_.size(); |
| 54 | } |
| 55 | |
| 56 | // Returns whether the shape is of the specified type (array, tuple, etc). |
| 57 | bool IsArray() const { return primitive_util::IsArrayType(element_type()); } |