Theano는 인덱스 할당을 지원하지 않습니다. 좋아,하지만이theano 텐서 변수의 단일 요소에 대한 인덱스 할당 값
theano.tensor.set_subtensor(x,y)
이고 그것을 당신이 [5] B = 또는 [5] + = B 그런 짓을하려는 경우, theano.tensor를 참조 stated
것입니다. 아래 set_subtensor() 및 theano.tensor.inc_subtensor()를 참조하십시오.
따라서 set_subtensor는 인덱스 할당 작업을 시뮬레이트합니까? 글쎄. set_subtensor는 다음 예제와 같이 ndims가 < 인 경우 예상대로 작동하는 것 같습니다.
>>> a = theano.tensor.zeros(10)
>>> a.eval()
array([ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.], dtype=float32)
>>> aa = theano.tensor.set_subtensor(a[5], 5.0)
>>> aa.eval()
array([ 0., 0., 0., 0., 0., 5., 0., 0., 0., 0.], dtype=float32)
멋진, a.shape == aa.shape하는 [5] = 5.0의 다음 더 어두워로 해보자 복제 할 = AA를 설정할 수 있습니다. set_subtensor 대상 인덱스에 지정된 값을 할당 한 동안
>>> b = theano.tensor.zeros((5,5))
>>> b.eval()
array([[ 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0.]], dtype=float32)
>>> bb = theano.tensor.set_subtensor(b[2][2], 5.0)
>>> bb.eval()
array([ 0., 0., 5., 0., 0.], dtype=float32)
>>> bb.shape.eval()
array([5])
, 그것은 업데이트 된 값으로 전체 업데이트 텐서 변수 있었으나 결국 subtensor를 반환하지 않습니다.
ndims> = 2 인 theano tensors의 단일 요소에 인덱스 값을 할당하는 방법을 아는 사람이 있습니까?