【发布时间】:2019-01-27 07:47:59
【问题描述】:
【问题讨论】:
-
在关闭此 q 之前,它将 grad_h 数组中小于零的所有值分配为零
-
如果
grad_h是 dict 并且h = 1是 int 那么:grad_h[h < 0] = 0将导致grad_h = {False: 0} -
这是可行的,因为
grad_h是一个 NumPy 数组。 -
这几乎可以肯定是现有问题的重复,但答案很好;我们只需要为您找到它。
-
同时,这里是the relevant section in the numpy user guide,它很好地解释了事情。
标签: python python-3.x list syntax pytorch