| 74 | } |
| 75 | } |
| 76 | Maybe<void> Parameter::set_data(const std::shared_ptr<Tensor>& other) { |
| 77 | if (is_local() && is_eager()) { |
| 78 | auto rematable_storage = std::dynamic_pointer_cast<vm::RematableTensorStorage>( |
| 79 | CHECK_JUST(tensor_->eager_blob_object())->tensor_storage()); |
| 80 | bool enable_remat = rematable_storage != nullptr && tensor_->is_local() && tensor_->is_eager(); |
| 81 | if (enable_remat) { rematable_storage->set_eviction_disabled(false); } |
| 82 | JUST(tensor_->set_data(other)); |
| 83 | if (enable_remat) { rematable_storage->set_eviction_disabled(true); } |
| 84 | } else { |
| 85 | JUST(tensor_->set_data(other)); |
| 86 | } |
| 87 | return Maybe<void>::Ok(); |
| 88 | } |
| 89 | |
| 90 | std::shared_ptr<Tensor> Parameter::contiguous() const { |
| 91 | const auto& tensor = std::const_pointer_cast<Tensor>(shared_from_this()); |
no test coverage detected