提交 e8e01f4e authored 作者: Frédéric Bastien's avatar Frédéric Bastien 提交者: GitHub

Merge pull request #5406 from chinnadhurai/ccw_numpy

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