提交 9dfbff30 authored 作者: sentient07's avatar sentient07

Fix for SupportCodeError and KeyError

上级 3f9d0601
...@@ -54,7 +54,7 @@ def _atexit_print_fn(): ...@@ -54,7 +54,7 @@ def _atexit_print_fn():
destination_file = open(config.profiling.destination, 'w') destination_file = open(config.profiling.destination, 'w')
for ps in _atexit_print_list: for ps in _atexit_print_list:
if ps.fct_callcount or ps.compile_time > 0: if ps.fct_callcount > 1 or ps.compile_time > 1:
ps.summary(file=destination_file, ps.summary(file=destination_file,
n_ops_to_print=config.profiling.n_ops, n_ops_to_print=config.profiling.n_ops,
n_apply_to_print=config.profiling.n_apply) n_apply_to_print=config.profiling.n_apply)
......
...@@ -164,12 +164,7 @@ def op_lifter(OP, cuda_only=False): ...@@ -164,12 +164,7 @@ def op_lifter(OP, cuda_only=False):
clients = [c for o in node.outputs for c in o.clients] clients = [c for o in node.outputs for c in o.clients]
# list of list containing clients # list of list containing clients
# it is clients per node basis # it is clients per node basis
out_clients = [] out_clients = [o.clients for o in node.outputs]
for o in node.outputs:
if o.clients:
out_clients.append(o.clients)
else:
out_clients.append([])
if not replace: if not replace:
# We replace if *all* clients are on the GPU # We replace if *all* clients are on the GPU
...@@ -268,7 +263,6 @@ class GraphToGPU(Optimizer): ...@@ -268,7 +263,6 @@ class GraphToGPU(Optimizer):
def apply(self, fgraph): def apply(self, fgraph):
mapping = {} mapping = {}
move_to_GPU = True
# Building a new graph # Building a new graph
# Iterating through inputs of graph # Iterating through inputs of graph
...@@ -288,27 +282,22 @@ class GraphToGPU(Optimizer): ...@@ -288,27 +282,22 @@ class GraphToGPU(Optimizer):
continue continue
# Move only if any of the inputs are on the GPU. # Move only if any of the inputs are on the GPU.
move_to_GPU = True move_to_GPU = False
'''
if any([isinstance(i, GpuArrayVariable) or if any([isinstance(i, GpuArrayVariable) or
isinstance(i, GpuArraySharedVariable) isinstance(i, GpuArraySharedVariable)
for i in [mapping[v] for v in node.inputs] + for i in [mapping[v] for v in node.inputs] +
node.outputs]): node.outputs]):
move_to_GPU = True move_to_GPU = True
'''
out_clients = [] out_clients = [o.clients for o in node.outputs]
for o in node.outputs:
if o.clients:
out_clients.append(o.clients)
else:
out_clients.append([])
context_name = None context_name = None
for i in [mapping[i] for i in node.inputs]: for i in [mapping[i] for i in node.inputs]:
if isinstance(i.type, GpuArrayType): if isinstance(i.type, GpuArrayType):
context_name = i.type.context_name context_name = i.type.context_name
move_to_GPU = True
break break
new_ops = None new_ops = None
...@@ -769,7 +758,6 @@ def local_gpua_split(op, context_name, inputs): ...@@ -769,7 +758,6 @@ def local_gpua_split(op, context_name, inputs):
@register_opt2([tensor.Subtensor], 'fast_compile') @register_opt2([tensor.Subtensor], 'fast_compile')
def local_gpua_subtensor(op, context_name, inputs, clients): def local_gpua_subtensor(op, context_name, inputs, clients):
x = inputs[0] x = inputs[0]
node = op.make_node(*inputs)
if (x.owner and isinstance(x.owner.op, HostFromGpu)): if (x.owner and isinstance(x.owner.op, HostFromGpu)):
gpu_x = x.owner.inputs[0] gpu_x = x.owner.inputs[0]
if (gpu_x.owner and if (gpu_x.owner and
...@@ -781,8 +769,6 @@ def local_gpua_subtensor(op, context_name, inputs, clients): ...@@ -781,8 +769,6 @@ def local_gpua_subtensor(op, context_name, inputs, clients):
for v in n.inputs + n.outputs]) for v in n.inputs + n.outputs])
for n, _ in clients[0]]): for n, _ in clients[0]]):
return return
else:
return [host_from_gpu(gpu_x.owner.op(node.outputs[0]))]
return GpuSubtensor(op.idx_list) return GpuSubtensor(op.idx_list)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论