| 88 | } |
| 89 | |
| 90 | std::shared_ptr<Tensor> Parameter::contiguous() const { |
| 91 | const auto& tensor = std::const_pointer_cast<Tensor>(shared_from_this()); |
| 92 | if (tensor_->is_contiguous()) { return tensor; } |
| 93 | return CHECK_JUST(functional::ToContiguous(tensor)); |
| 94 | } |
| 95 | |
| 96 | std::shared_ptr<Tensor> Parameter::pin_memory() const { |
| 97 | std::shared_ptr<Tensor> tensor = std::const_pointer_cast<Tensor>(shared_from_this()); |