提交 9ed8724e authored 作者: Benjamin Scellier's avatar Benjamin Scellier

file theano/misc/safe_asarray.py

上级 dcfe53fd
...@@ -3,7 +3,7 @@ Helper function to safely convert an array to a new data type. ...@@ -3,7 +3,7 @@ Helper function to safely convert an array to a new data type.
""" """
from __future__ import absolute_import, print_function, division from __future__ import absolute_import, print_function, division
import numpy import numpy as np
import theano import theano
...@@ -30,8 +30,8 @@ def _asarray(a, dtype, order=None): ...@@ -30,8 +30,8 @@ def _asarray(a, dtype, order=None):
""" """
if str(dtype) == 'floatX': if str(dtype) == 'floatX':
dtype = theano.config.floatX dtype = theano.config.floatX
dtype = numpy.dtype(dtype) # Convert into dtype object. dtype = np.dtype(dtype) # Convert into dtype object.
rval = numpy.asarray(a, dtype=dtype, order=order) rval = np.asarray(a, dtype=dtype, order=order)
# Note that dtype comparison must be done by comparing their `num` # Note that dtype comparison must be done by comparing their `num`
# attribute. One cannot assume that two identical data types are pointers # attribute. One cannot assume that two identical data types are pointers
# towards the same object (e.g. under Windows this appears not to be the # towards the same object (e.g. under Windows this appears not to be the
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论