Returns true if it is a scalar
| 444 | |
| 445 | // Returns true if it is a scalar |
| 446 | bool IsScalar(const TensorShapeProto& proto) { |
| 447 | // Returns false when rank is unknown |
| 448 | if (proto.unknown_rank()) { |
| 449 | return false; |
| 450 | } |
| 451 | // Returns false when dimension is unknown |
| 452 | for (const auto& dim : proto.dim()) { |
| 453 | if (dim.size() < 0) { |
| 454 | return false; |
| 455 | } |
| 456 | } |
| 457 | return (TensorShape(proto).num_elements() == 1); |
| 458 | } |
| 459 | |
| 460 | bool FindContractionWithBias(const RemapperContext& ctx, int node_index, |
| 461 | ContractionWithBiasAdd* matched, |