Writer.add_scalars error

Hi,

 tmp = correct / total
 tmp = torch.as_tensor(tmp)
 writer.add_scalars('accuracy/' + label,
                              {'test': tmp},
                               global_step=(epoch + 1) * len(trainloader))

I got this error:

TypeError: add(): argument 'other' (position 1) must be Tensor, not str

While

>>tmp.type()
'torch.FloatTensor'
>>label.type()
'torch.LongTensor'

Would you have any advices?

Thanks

Hi,
No body have any ideas?

Could you post a small executable code snippet, which yields this error, pleas?

Thanks for your reply.
Fortunately, I found what caused this error. I redefined label as a string in a place of code.