Returns true if the given Shape has a TOKEN shape as any subshape.
| 1280 | |
| 1281 | // Returns true if the given Shape has a TOKEN shape as any subshape. |
| 1282 | bool ShapeContainsToken(const Shape& shape) { |
| 1283 | bool contains_token = false; |
| 1284 | ShapeUtil::ForEachSubshape( |
| 1285 | shape, [&contains_token](const Shape& subshape, const ShapeIndex&) { |
| 1286 | if (subshape.IsToken()) { |
| 1287 | contains_token = true; |
| 1288 | } |
| 1289 | }); |
| 1290 | return contains_token; |
| 1291 | } |
| 1292 | |
| 1293 | // Verifies that all types entering and exiting the entry computation are |
| 1294 | // legal. |
no test coverage detected