提交 44480978 authored 作者: sentient07's avatar sentient07

Removed the unnecessary print statements and added missing documentation

上级 8ea065e6
......@@ -26,7 +26,7 @@ from . import pygpu
from .type import get_context, gpu_context_type, list_contexts
from .basic_ops import (as_gpuarray_variable, infer_context_name,
gpu_contiguous, gpu_alloc_empty,
empty_like)
empty_like, GpuArrayType)
from .elemwise import GpuElemwise
# These don't exist in gpuarray
......@@ -1438,8 +1438,8 @@ def local_abstractconv_cudnn_graph(op, context_name, inputs, outputs):
if (op.filter_dilation != (1, 1)):
return None
inp1 = as_gpuarray_variable(inputs[0], context_name)
inp2 = as_gpuarray_variable(inputs[1], context_name)
inp1 = inputs[0]
inp2 = inputs[1]
if not dnn_available(inp1.type.context_name):
raise_no_cudnn()
......@@ -1476,6 +1476,8 @@ def local_abstractconv_cudnn_graph(op, context_name, inputs, outputs):
AbstractConv2d_gradInputs])
def local_abstractconv_cudnn(node):
ctx = infer_context_name(*node.inputs)
if not isinstance(node.inputs[0].type, GpuArrayType):
return
return local_abstractconv_cudnn_graph(node.op, ctx, node.inputs, node.outputs)
conv_groupopt.register('local_abstractconv_cudnn_graph',
......
......@@ -30,7 +30,7 @@ from theano.tensor.nnet.abstract_conv import (AbstractConv2d,
from theano.tests.breakpoint import PdbBreakpoint
from .type import (GpuArrayType, GpuArrayConstant, get_context,
ContextNotDefined)
ContextNotDefined, GpuArraySharedVariable, GpuArrayVariable)
from .basic_ops import (as_gpuarray_variable, infer_context_name,
host_from_gpu, GpuToGpu,
HostFromGpu, GpuFromHost,
......@@ -107,6 +107,19 @@ def register_opt(*tags, **kwargs):
def register_opt2(tracks, *tags, **kwargs):
'''
Decorator for the new GraphToGPU optimizer.
Takes an extra parameter(Op) compared to register_opt decorator.
Parameters
----------
tracks : Op
The Node's Op to which optimization is being applied.
tags : String
The tag optimization mode to which the optimizer will be registered.
'''
def f(local_opt):
name = (kwargs and kwargs.pop('name')) or local_opt.__name__
opt = theano.gof.local_optimizer(tracks)(local_opt)
......@@ -315,7 +328,12 @@ class GraphToGPU(NavigatorOptimizer):
# Move only if any of the inputs are on the GPU.
move_to_GPU = False
if any([isinstance(i, GpuArrayVariable) or
isinstance(i, GpuArraySharedVariable)
for i in [mapping[v] for v in node.inputs] +
node.outputs]):
move_to_GPU = True
context_name = None
for i in [mapping[i] for i in node.inputs]:
if isinstance(i.type, GpuArrayType):
......@@ -416,13 +434,6 @@ class GraphToGPU(NavigatorOptimizer):
not_used = []
not_used_time = 0
for s in list(set(old_not_transferred)):
print(blanc, 'Nodes not transferred by old opt : ' + str(s), file=stream)
for n in list(set(new_not_transferred)):
print(blanc, 'Nodes not transferred by new optimizer : ' + str(n), file=stream)
for d in list(set(set(new_not_transferred) - set(old_not_transferred))):
print(blanc, 'Not transferred difference : ', str(d), file=stream)
for o, count in iteritems(process_count):
if count > 0:
count_opt.append((time_opts[o], count,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论