| 856 | } |
| 857 | |
| 858 | uint64 OpDefHash(const OpDef& o) { |
| 859 | uint64 h = RepeatedAttrDefHash(o.attr()); |
| 860 | |
| 861 | // Compute deterministic order-independent control outputs hash. |
| 862 | std::set<string> control_output(o.control_output().begin(), |
| 863 | o.control_output().end()); |
| 864 | for (const auto& co : control_output) h = Hash64Combine(h, Hash64(co)); |
| 865 | |
| 866 | OpDef o_copy = o; |
| 867 | o_copy.clear_attr(); |
| 868 | o_copy.clear_control_output(); |
| 869 | return DeterministicProtoHash64(o_copy, h); |
| 870 | } |
| 871 | |
| 872 | } // namespace tensorflow |