提交 395c211e authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Remove the old sparse_grad interface.

上级 04d73513
......@@ -450,22 +450,6 @@ class TestConstructSparseFromList(unittest.TestCase):
g = theano.grad(sub.sum(), m)
assert isinstance(g.owner.op, tensor.AdvancedIncSubtensor1)
# Test that we create a sparse grad when asked
# OLD INTERFACE
m = theano.tensor.matrix()
sub = m[v]
m.type.sparse_grad = True
g = theano.grad(sub.sum(), m)
assert isinstance(g.owner.op, ConstructSparseFromList)
# Test that we create a sparse grad when asked
# OLD INTERFACE CONSEQUENCE
m = theano.tensor.matrix()
sub = m[v]
sub.type.sparse_grad = True
g = theano.grad(sub.sum(), m)
assert isinstance(g.owner.op, ConstructSparseFromList)
# Test that we create a sparse grad when asked
# USER INTERFACE
m = theano.tensor.matrix()
......
......@@ -1567,14 +1567,7 @@ class AdvancedSubtensor1(Op):
x, ilist = inputs
gz, = grads
assert len(inputs) == 2
sparse = False
if getattr(x.type, 'sparse_grad', False):
sparse = True
warnings.warn(
"DEPRECATION WARNING: AdvancedSubtensor1, you are using"
" an old interface to the sparse grad. You should use"
" theano.sparse_grad(a_tensor[an_int_vector]). ")
if sparse or self.sparse_grad:
if self.sparse_grad:
if x.type.ndim != 2:
raise TypeError(
"AdvancedSubtensor1: you can't take the sparse grad"
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论