提交 ba683cc7 authored 作者: ChienliMa's avatar ChienliMa

Forgot to execute a test.It seems that theano.tensor can not be imported from…

Forgot to execute a test.It seems that theano.tensor can not be imported from the top of the file. However, functions that I need are in basic.py therefore there's no need to import theano.tensor or anything else.
上级 3cd25b78
...@@ -2,7 +2,6 @@ import numpy as np ...@@ -2,7 +2,6 @@ import numpy as np
import numpy import numpy
import theano import theano
import theano.tensor as T
from theano.tensor import basic from theano.tensor import basic
...@@ -816,23 +815,23 @@ class FillDiagonalOffset(gof.Op): ...@@ -816,23 +815,23 @@ class FillDiagonalOffset(gof.Op):
# only valid for matrices # only valid for matrices
wr_a = fill_diagonal_offset(grad, 0, offset) wr_a = fill_diagonal_offset(grad, 0, offset)
offset_abs = T.abs_( offset ) offset_abs = basic.abs_( offset )
pos_offset_flag = T.ge( offset, 0 ) pos_offset_flag = basic.ge( offset, 0 )
neg_offset_flag = T.lt( offset, 0 ) neg_offset_flag = basic.lt( offset, 0 )
min_wh = T.minimum(width,height) min_wh = basic.minimum(width,height)
start = offset * pos_offset_flag + offset_abs * width \ start = offset * pos_offset_flag + offset_abs * width \
* neg_offset_flag * neg_offset_flag
num_of_step = T.minimum( min_wh, width * pos_offset_flag num_of_step = basic.minimum( min_wh, width * pos_offset_flag
+ height * neg_offset_flag - offset_abs ) + height * neg_offset_flag - offset_abs )
step = a.shape[1] + 1 step = a.shape[1] + 1
end = start + step * num_of_step end = start + step * num_of_step
# input of slice should be integer # input of slice should be integer
start = T.cast(start,'int32') start = basic.cast(start,'int32')
step = T.cast(step,'int32') step = basic.cast(step,'int32')
end = T.cast(end,'int32') end = basic.cast(end,'int32')
wr_val = grad.flatten()[start:end:step].sum() wr_val = grad.flatten()[start:end:step].sum()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论