Let var = torch.randn(10,5)  then,
if you want to multiply the columns use torch.prod(1) the result will have dimension (10,1)
and if you want to multiply the rows use torch.prod(0) the result will have dimension (1,5)