Fix the bug of mismatching datatype in print_to_screen (#866)
Co-authored-by: liumg <mengge.liu@mobvoi.com>
This commit is contained in:
parent
8e131dd43b
commit
596d11a72c
|
@ -431,8 +431,8 @@ void print_to_file(T *result, const int size, char *file)
|
|||
template <typename T>
|
||||
void print_to_screen(T *result, const int size)
|
||||
{
|
||||
float *tmp = (float *)malloc(sizeof(float) * size);
|
||||
check_cuda_error(cudaMemcpy(tmp, result, sizeof(float) * size, cudaMemcpyDeviceToHost));
|
||||
T *tmp = (T *)malloc(sizeof(T) * size);
|
||||
check_cuda_error(cudaMemcpy(tmp, result, sizeof(T) * size, cudaMemcpyDeviceToHost));
|
||||
for (int i = 0; i < size; ++i)
|
||||
printf("%d, %f\n", i, (float)tmp[i]);
|
||||
free(tmp);
|
||||
|
|
Loading…
Reference in a new issue