Mensaje de error:
view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.
código de error:
prec1 = accuracy(-1 * dist_xt_ct.data, target_targets, topk=(1,))[0].item()
Código correcto:
prec1 = accuracy(-1 * dist_xt_ct.data, target_targets, topk=(1,)).item()
¡Simplemente elimine [0]!