| 346 | } |
| 347 | |
| 348 | void copy(const DeviceDnTen<T>& other){ |
| 349 | gpu_id = other.gpu_id; |
| 350 | num_dims = other.num_dims; |
| 351 | total_size = other.total_size; |
| 352 | |
| 353 | // TODO: here we need more safe code |
| 354 | this->dimensions = (size_s*)malloc(sizeof(size_s) * num_dims); |
| 355 | std::memcpy(dimensions, other.dimensions, sizeof(size_s) * num_dims); |
| 356 | |
| 357 | this->allocate(); |
| 358 | CHECK_CUDA(cudaDeviceSynchronize()); |
| 359 | cudaMemcpy(vals, other.vals, sizeof(T) * total_size, cudaMemcpyDeviceToDevice); |
| 360 | CHECK_CUDA(cudaDeviceSynchronize()); |
| 361 | } |
| 362 | |
| 363 | inline void allocate() { |
| 364 |
no test coverage detected