| 886 | } |
| 887 | |
| 888 | size_t LiteralBase::Hash() const { |
| 889 | using tensorflow::Hash64; |
| 890 | using tensorflow::Hash64Combine; |
| 891 | |
| 892 | size_t hash_value = ShapeUtil::Hash(shape()); |
| 893 | |
| 894 | ShapeUtil::ForEachSubshape( |
| 895 | shape(), [&](const Shape& subshape, const ShapeIndex& index) { |
| 896 | if (!subshape.IsArray()) { |
| 897 | return; |
| 898 | } |
| 899 | |
| 900 | CHECK(LayoutUtil::IsDense(subshape.layout())); |
| 901 | hash_value = Hash64Combine( |
| 902 | hash_value, Hash64(static_cast<const char*>(untyped_data(index)), |
| 903 | size_bytes(index))); |
| 904 | }); |
| 905 | |
| 906 | return hash_value; |
| 907 | } |
| 908 | |
| 909 | Status MutableLiteralBase::SetIntegralAsS64(absl::Span<const int64> multi_index, |
| 910 | int64 value) { |