| 228 | |
| 229 | template<typename T> |
| 230 | ft::Tensor toDevice(ft::Tensor& host_tensor) |
| 231 | { |
| 232 | if (host_tensor.data == nullptr) { |
| 233 | return ft::Tensor(); |
| 234 | } |
| 235 | ft::Tensor device_tensor = createTensor(ft::MEMORY_GPU, host_tensor.type, host_tensor.shape); |
| 236 | ft::cudaAutoCpy(device_tensor.getPtr<T>(), host_tensor.getPtr<T>(), host_tensor.size(), stream); |
| 237 | return device_tensor; |
| 238 | }; |
| 239 | |
| 240 | void copyTensor(ft::Tensor& dst, ft::Tensor& src) |
| 241 | { |