Does slice or index of chainer.Variable to get ite

2019-08-19 02:40发布

Does the following code chainer.Variable still have ability to hold graph and can backward (gradient flow) after slice(a[0,1] or index(a[0]):

>>> a = chainer.Variable(np.array([[1,2,3],[10,11,12]]))
>>> a
variable([[ 1,  2,  3],
          [10, 11, 12]])
>>> a[0]
variable([1, 2, 3])
>>> a[0, 1]
variable([1])

标签: chainer
1条回答
萌系小妹纸
2楼-- · 2019-08-19 02:59

Yes. Indexing of chainer.Variable supports backprop.

查看更多
登录 后发表回答