标签: python pytorch tensor
我想通过for循环生成t.nn.Parameter类型的权重,但是self.weights列表只能得到一个元素,并在Pycharm中发出警告:
t.nn.Parameter
self.weights
'tensor' is not callable.
这是代码:
for w in weights[:-1]: self.weights += [t.nn.Parameter(t.tensor([w], requires_grad=True))]