| 76 | Tensor::Tensor(const std::shared_ptr<TensorViewImpl>& impl) : impl_(impl) {} |
| 77 | |
| 78 | Tensor Tensor::empty(const std::vector<int32_t>& shape, DataTypes dtype, DeviceTypes device) { |
| 79 | auto storage = TensorStorage::create(shape, dtype, device); |
| 80 | auto impl = TensorViewImpl::create(shape, storage); |
| 81 | return Tensor(impl); |
| 82 | } |
| 83 | |
| 84 | Tensor Tensor::constant(float x, DataTypes dtype, DeviceTypes device) { |
| 85 | auto rhs_tensor = Tensor::empty({1}, dtype, device).alloc(); |