idx can be negative for an offset from end of dimensions. idx must be in the range [-1 * s.rank, s.rank).
| 340 | // idx can be negative for an offset from end of dimensions. |
| 341 | // idx must be in the range [-1 * s.rank, s.rank). |
| 342 | DimensionHandle Dim(ShapeHandle s, int64 idx) { |
| 343 | if (s->rank_ == kUnknownRank) { |
| 344 | return UnknownDim(); |
| 345 | } |
| 346 | return DimKnownRank(s, idx); |
| 347 | } |
| 348 | // As above, but asserts that the rank of the shape is known. |
| 349 | static DimensionHandle DimKnownRank(ShapeHandle s, int64 idx) { |
| 350 | CHECK_NE(s->rank_, kUnknownRank); |
no outgoing calls