提交 92cdbe39 authored 作者: James Bergstra's avatar James Bergstra

fixed optimization that inserted reshape

上级 7a508e7d
...@@ -1257,7 +1257,8 @@ class GpuSum(Op): ...@@ -1257,7 +1257,8 @@ class GpuSum(Op):
class GpuReshape(tensor.Reshape): class GpuReshape(tensor.Reshape):
# __hash__, __eq__, __str__ come from tensor.Subtensor # __hash__, __eq__, __str__ come from tensor.Subtensor
def make_node(self, x, shp): def make_node(self, x, shp):
return Apply(self, [x, shp], [CudaNdarrayType([False]*self.ndim)()]) host_reshaped = host_from_gpu(x).reshape(shp)
return Apply(self, [x, shp], [CudaNdarrayType(host_reshaped.broadcastable)()])
def perform(self, node, (x, shp), (out,)): def perform(self, node, (x, shp), (out,)):
if (len(shp) != self.ndim): if (len(shp) != self.ndim):
raise ValueError('shape argument to Reshape.perform has incorrect length %i' raise ValueError('shape argument to Reshape.perform has incorrect length %i'
......
import sys import sys
import theano
from theano import tensor, scalar, compile from theano import tensor, scalar, compile
from theano.gof import local_optimizer, EquilibriumDB, SequenceDB from theano.gof import local_optimizer, EquilibriumDB, SequenceDB
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论