I have an inquiry about computing the classification accuracy with output and ground truth in C++,
in python it is:
acc = torch.mean((output_label.max(1) == y).float())
where output_label is of the size 64 by 10, here 64 is the batch size and 10 is the number of classes, and y is of the size 64.
In C++, I convert it to be
but I get a running error when computing acc as labelmax is a tuple, saying :
terminate called after throwing an instance of ‘c10::Error’
what(): Can only calculate the mean of floating types. Got Bool instead.
Exception raised from mean_out_cpu_gpu at /pytorch/aten/src/ATen/native/ReduceOps.cpp:507
Any suggestions to fix that please ?