| 44 | } |
| 45 | |
| 46 | void TensorNameScope::Record(const Tensor* tensor, const std::string& name) { |
| 47 | uint64_t key = reinterpret_cast<uint64_t>(tensor); |
| 48 | auto* tensor_names = [&]() { |
| 49 | if (tensor->is_lazy()) { return &lazy_tensor_names_; } |
| 50 | return &eager_tensor_names_; |
| 51 | }(); |
| 52 | std::lock_guard<std::mutex> lock(mutex_); |
| 53 | // We assume that the name of the tensor will be update more than once. |
| 54 | (*tensor_names)[key] = name; |
| 55 | } |
| 56 | |
| 57 | void TensorNameScope::Record(const std::shared_ptr<Tensor>& tensor, const std::string& name) { |
| 58 | Record(tensor.get(), name); |
no test coverage detected