| 32 | namespace functional = of::one::functional; |
| 33 | |
| 34 | Tensor::Tensor(const Shape& shape, const Device& device, const DType& dtype) { |
| 35 | of::LazyMode::Guard lazy_mode_disabled_guard(/*is_enabled*/ false); |
| 36 | tensor_ = functional::Empty(*shape.shape_, |
| 37 | of::DType::Get(static_cast<of::DataType>(dtype)).GetOrThrow(), |
| 38 | *device.device_, /*requires_grad=*/false, /*pin_memory=*/false) |
| 39 | .GetPtrOrThrow(); |
| 40 | } |
| 41 | Tensor::Tensor(const std::shared_ptr<oneflow::one::Tensor>& tensor) : tensor_(tensor) {} |
| 42 | |
| 43 | Tensor::Tensor(const Tensor& tensor) : tensor_(tensor.tensor_) {} |