What is the best way to deal with matplot lib and torch?

Do I have to keep converting between my torch tensors/variables to numpy for it to work?

I got error:

    return array(a, dtype, copy=False, order=order)
TypeError: float() argument must be a string or a number, not 'torch.FloatTensor'

so yes?

Yes, you have to convert your tensor into numpy with Tensor.numpy in order to use matplotlib.

However, your error comes from the fact you are trying to convert into a float a whole tensor, like:

t = Tensor(5)

Apparently, your tensor is already containing floats, so the conversion is not necessary. But the good way to do it would be t.float().
Then, to convert into numpy, and use matplotlib just do:

n = t.numpy()