| 906 | } |
| 907 | |
| 908 | string Canonicalize(const string& funcname, AttrSlice attrs, |
| 909 | const FunctionLibraryRuntime::InstantiateOptions& options) { |
| 910 | std::vector<string> entries; |
| 911 | entries.reserve(attrs.size() + static_cast<int>(options.target.empty()) + |
| 912 | options.input_devices.size()); |
| 913 | for (auto p : attrs) { |
| 914 | if (p.first != kExecutorAttr) { |
| 915 | entries.push_back(strings::StrCat(p.first, "=", Print(p.second))); |
| 916 | } |
| 917 | } |
| 918 | if (!options.target.empty()) { |
| 919 | entries.push_back( |
| 920 | strings::StrCat("_target", "=", absl::CEscape(options.target))); |
| 921 | } |
| 922 | for (int i = 0; i < options.input_devices.size(); ++i) { |
| 923 | entries.push_back(strings::StrCat("_input_dev", i, "=", |
| 924 | absl::CEscape(options.input_devices[i]))); |
| 925 | } |
| 926 | for (int i = 0; i < options.output_devices.size(); ++i) { |
| 927 | entries.push_back(strings::StrCat( |
| 928 | "_output_dev", i, "=", absl::CEscape(options.output_devices[i]))); |
| 929 | } |
| 930 | for (const auto& iter : options.input_tensor_shapes) { |
| 931 | entries.push_back( |
| 932 | strings::StrCat("_input_tensor_shape", iter.first, "=", |
| 933 | absl::CEscape(iter.second.DebugString()))); |
| 934 | } |
| 935 | for (const auto& iter : options.input_resource_dtypes_and_shapes) { |
| 936 | entries.push_back(strings::StrCat("_input_resource_dtype", iter.first, "=", |
| 937 | DataTypeString(iter.second.dtype))); |
| 938 | entries.push_back( |
| 939 | strings::StrCat("_input_resource_shape", iter.first, "=", |
| 940 | absl::CEscape(iter.second.shape.DebugString()))); |
| 941 | } |
| 942 | if (options.lib_def) { |
| 943 | entries.push_back(strings::StrCat( |
| 944 | "_lib_def", "=", reinterpret_cast<uintptr_t>(options.lib_def))); |
| 945 | } |
| 946 | if (!options.state_handle.empty()) { |
| 947 | entries.push_back( |
| 948 | strings::StrCat("_state_handle", "=", options.state_handle)); |
| 949 | } |
| 950 | string executor_type = FunctionLibraryRuntime::ExecutorType(options, attrs); |
| 951 | if (!executor_type.empty()) { |
| 952 | entries.push_back(strings::StrCat(kExecutorAttr, "=", executor_type)); |
| 953 | } |
| 954 | string config_proto_serialized; |
| 955 | options.config_proto.SerializeToString(&config_proto_serialized); |
| 956 | if (!config_proto_serialized.empty()) { |
| 957 | entries.push_back(strings::StrCat("_config_proto", "=", |
| 958 | absl::CEscape(config_proto_serialized))); |
| 959 | } |
| 960 | std::sort(entries.begin(), entries.end()); |
| 961 | return strings::StrCat(funcname, "[", absl::StrJoin(entries, ","), "]"); |
| 962 | } |
| 963 | |
| 964 | FunctionCallFrame::FunctionCallFrame(DataTypeSlice arg_types, |
| 965 | DataTypeSlice ret_types) |
nothing calls this directly
no test coverage detected