提交 3fe88147 authored 作者: amrithasuresh's avatar amrithasuresh

Updated numpy as np

上级 2f4ac5a7
from __future__ import absolute_import, print_function, division from __future__ import absolute_import, print_function, division
import numpy import numpy as np
from theano import gof from theano import gof
from theano.gof import Constant, Generic, Op from theano.gof import Constant, Generic, Op
from theano.gof.sched import key_to_cmp from theano.gof.sched import key_to_cmp
...@@ -27,7 +27,7 @@ class LoadFromDisk(Op): ...@@ -27,7 +27,7 @@ class LoadFromDisk(Op):
__props__ = ("dtype", "broadcastable", "mmap_mode") __props__ = ("dtype", "broadcastable", "mmap_mode")
def __init__(self, dtype, broadcastable, mmap_mode=None): def __init__(self, dtype, broadcastable, mmap_mode=None):
self.dtype = numpy.dtype(dtype) # turn "float64" into numpy.float64 self.dtype = np.dtype(dtype) # turn "float64" into np.float64
self.broadcastable = broadcastable self.broadcastable = broadcastable
if mmap_mode not in (None, 'c'): if mmap_mode not in (None, 'c'):
raise ValueError("The only supported values for mmap_mode " raise ValueError("The only supported values for mmap_mode "
...@@ -44,7 +44,7 @@ class LoadFromDisk(Op): ...@@ -44,7 +44,7 @@ class LoadFromDisk(Op):
path = inp[0] path = inp[0]
if (path.split('.')[-1] == 'npz'): if (path.split('.')[-1] == 'npz'):
raise ValueError("Expected a .npy file, got %s instead" % path) raise ValueError("Expected a .npy file, got %s instead" % path)
result = numpy.load(path, mmap_mode=self.mmap_mode) result = np.load(path, mmap_mode=self.mmap_mode)
if result.dtype != self.dtype: if result.dtype != self.dtype:
raise TypeError("Expected an array of type %s, got %s instead" % raise TypeError("Expected an array of type %s, got %s instead" %
(self.dtype, result.dtype)) (self.dtype, result.dtype))
...@@ -125,7 +125,7 @@ class MPIRecv(Op): ...@@ -125,7 +125,7 @@ class MPIRecv(Op):
self.source = source self.source = source
self.tag = tag self.tag = tag
self.shape = shape self.shape = shape
self.dtype = numpy.dtype(dtype) # turn "float64" into numpy.float64 self.dtype = np.dtype(dtype) # turn "float64" into numpy.float64
self.broadcastable = (False,) * len(shape) self.broadcastable = (False,) * len(shape)
def make_node(self): def make_node(self):
...@@ -135,7 +135,7 @@ class MPIRecv(Op): ...@@ -135,7 +135,7 @@ class MPIRecv(Op):
def perform(self, node, inp, out): def perform(self, node, inp, out):
data = numpy.zeros(self.shape, dtype=self.dtype) data = np.zeros(self.shape, dtype=self.dtype)
request = comm.Irecv(data, self.source, self.tag) request = comm.Irecv(data, self.source, self.tag)
out[0][0] = request out[0][0] = request
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论