Я не могу использовать torch.Tensor () с параметром require_grad (версия факела: 0.4.1)
без require_grad:
x = torch.Tensor([[.5, .3, 2.1]])
print(x)
> tensor([[0.5000, 0.3000, 2.1000]])
с require_grad = True или require_grad = False:
x = torch.Tensor([[.5, .3, 2.1]], requires_grad=False)
print(x)
Traceback (most recent call last):
File "D:/_P/dev/ai/pytorch/notes/tensor01.py", line 4, in <module>
x = torch.Tensor([[.5, .3, 2.1]], requires_grad=False)
TypeError: new() received an invalid combination of arguments - got (list, requires_grad=bool), but expected one of:
* (torch.device device)
* (torch.Storage storage)
* (Tensor other)
* (tuple of ints size, torch.device device)
didn't match because some of the keywords were incorrect: requires_grad
* (object data, torch.device device)
didn't match because some of the keywords were incorrect: requires_grad