【发布时间】:2019-12-28 15:59:26
【问题描述】:
执行以下方法时:
def flatten(t):
t = t.reshape(1, −1)
t = t.squeeze()
return t
Python 抱怨第二个参数。
File "pytorch.py", line 16
t = t.reshape(1, −1)
^ SyntaxError: invalid character in identifier
我的 pytorch 版本是 1.3.1。 我已经尝试删除参数之前的空格,但没有效果。有什么想法吗?
【问题讨论】:
-
按照现在的样子,你的方法好像没有缩进?
-
reddit 在粘贴后搞砸了。感谢您的提示!
标签: character pytorch reshape identifier