提交 c0243f4c authored 作者: Benjamin Scellier's avatar Benjamin Scellier

file theano/compile/ops.py

上级 456f3676
......@@ -17,7 +17,7 @@ from six import iteritems, integer_types
from six.moves import xrange
import numpy
import numpy as np
def register_view_op_c_code(type, code, version=()):
......@@ -338,7 +338,7 @@ class Shape_i(gof.Op):
def __init__(self, i):
# As i will be used in the hash and that ndarray are not hashable,
# we need to convert it to an int as it is hashable.
if isinstance(i, numpy.ndarray):
if isinstance(i, np.ndarray):
assert i.dtype in theano.tensor.integer_dtypes
assert i == int(i)
i = int(i)
......@@ -665,11 +665,11 @@ class Rebroadcast(gof.Op):
items = sorted(axis)
self.axis = OrderedDict(items)
for axis, broad in iteritems(self.axis):
if not isinstance(axis, (numpy.integer, integer_types)):
if not isinstance(axis, (np.integer, integer_types)):
raise TypeError("Rebroadcast needs integer axes. "
"Got {}".format(axis))
if not isinstance(broad, (numpy.bool_, bool)):
if not isinstance(broad, (np.bool_, bool)):
raise TypeError("Rebroadcast needs bool for new broadcast "
"pattern. Got {}".format(broad))
......@@ -835,7 +835,7 @@ class SpecifyShape(gof.Op):
x, shape = inp
out, = out_
assert x.ndim == shape.size
assert numpy.all(x.shape == shape), ("got shape", x.shape,
assert np.all(x.shape == shape), ("got shape", x.shape,
"expected", shape)
out[0] = x
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论