| 826 | } |
| 827 | |
| 828 | absl::optional<int64> LiteralBase::GetIntegralAsS64( |
| 829 | absl::Span<const int64> multi_index) const { |
| 830 | CHECK(LayoutUtil::IsDenseArray(shape())); |
| 831 | switch (shape().element_type()) { |
| 832 | case PRED: |
| 833 | return Get<bool>(multi_index); |
| 834 | case U8: |
| 835 | return Get<uint8>(multi_index); |
| 836 | case S32: |
| 837 | return Get<int32>(multi_index); |
| 838 | case S64: |
| 839 | return Get<int64>(multi_index); |
| 840 | case U32: |
| 841 | return Get<uint32>(multi_index); |
| 842 | case U64: |
| 843 | return Get<uint64>(multi_index); |
| 844 | default: |
| 845 | return absl::nullopt; |
| 846 | } |
| 847 | } |
| 848 | |
| 849 | absl::optional<double> LiteralBase::GetAsDouble( |
| 850 | absl::Span<const int64> multi_index) const { |
no test coverage detected