提交 8c2ce52f authored 作者: Chinnadhurai Sankar's avatar Chinnadhurai Sankar

numpy 1.12.0rc2 theano compatabilty fix related to variable typecasting

上级 60d25721
......@@ -5,6 +5,7 @@ import theano
import scipy.sparse
from theano import gof, tensor
from theano.tensor import discrete_dtypes
from theano.tensor.opt import register_specialize
from theano.sparse.basic import (
as_sparse_variable, SparseType, add_s_s, neg,
......@@ -116,6 +117,11 @@ class Binomial(gof.op.Op):
n = tensor.as_tensor_variable(n)
p = tensor.as_tensor_variable(p)
shape = tensor.as_tensor_variable(shape)
assert n.dtype in discrete_dtypes
assert p.dtype not in discrete_dtypes
assert shape.dtype in discrete_dtypes
return gof.Apply(self, [n, p, shape],
[SparseType(dtype=self.dtype,
format=self.format)()])
......
......@@ -62,7 +62,7 @@ class PoissonTester(utt.InferShapeTester):
class BinomialTester(utt.InferShapeTester):
n = tensor.scalar()
n = tensor.scalar(dtype='int64')
p = tensor.scalar()
shape = tensor.lvector()
_n = 5
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论