| 107 | |
| 108 | template<typename T> |
| 109 | bool fillTensorWithValue(void* devPtr, const size_t sizeBytes, const T value) |
| 110 | { |
| 111 | std::vector<T> hData(sizeBytes / sizeof(T), value); |
| 112 | const auto status = |
| 113 | cudaMemcpy(static_cast<uint8_t*>(devPtr), hData.data(), hData.size() * sizeof(T), cudaMemcpyHostToDevice); |
| 114 | if (status != cudaSuccess) { |
| 115 | return false; |
| 116 | } |
| 117 | return true; |
| 118 | }; |
| 119 | |
| 120 | //------------------------------------------------ |
| 121 |