提交 f7a24c47 authored 作者: Nan Rosemary Ke's avatar Nan Rosemary Ke

fix flake8 errors

上级 3ffd39ae
...@@ -699,7 +699,7 @@ Test them first, as they are not guaranteed to always provide a speedup.""") ...@@ -699,7 +699,7 @@ Test them first, as they are not guaranteed to always provide a speedup.""")
# import theano.tensor.signal.pool as pool # import theano.tensor.signal.pool as pool
# import theano.gpuarray # import theano.gpuarray
#for a, t in iteritems(apply_time): # for a, t in iteritems(apply_time):
# node = a[1] # node = a[1]
# if (isinstance(node.op, pool.Pool)): # if (isinstance(node.op, pool.Pool)):
# if (not cuda.dnn.dnn_available() and not theano.gpuarray.dnn.dnn_present()): # if (not cuda.dnn.dnn_available() and not theano.gpuarray.dnn.dnn_present()):
......
...@@ -122,14 +122,14 @@ class ProfileStats(object): ...@@ -122,14 +122,14 @@ class ProfileStats(object):
""" """
def reset(self): def reset(self):
""" Ignore previous function call""" """ Ignore previous function call"""
#self.compile_time = 0. # self.compile_time = 0.
self.fct_call_time = 0. self.fct_call_time = 0.
self.fct_callcount = 0 self.fct_callcount = 0
self.vm_call_time = 0. self.vm_call_time = 0.
self.apply_time = {} self.apply_time = {}
self.apply_callcount = {} self.apply_callcount = {}
# self.apply_cimpl = None # self.apply_cimpl = None
#self.messge = None # self.messge = None
# #
# Note on implementation: # Note on implementation:
# Class variables are used here so that each one can be # Class variables are used here so that each one can be
...@@ -1071,6 +1071,7 @@ class ProfileStats(object): ...@@ -1071,6 +1071,7 @@ class ProfileStats(object):
# Store the max of some stats by any function in this profile. # Store the max of some stats by any function in this profile.
max_sum_size = max(max_sum_size, sum_size) max_sum_size = max(max_sum_size, sum_size)
def compute_max_stats(running_memory, stats): def compute_max_stats(running_memory, stats):
(max_node_memory_size, (max_node_memory_size,
max_running_max_memory_size, max_running_max_memory_size,
...@@ -1260,7 +1261,7 @@ class ProfileStats(object): ...@@ -1260,7 +1261,7 @@ class ProfileStats(object):
def print_tips(self, file): def print_tips(self, file):
print("""Here are tips to potentially make your code run faster print("""Here are tips to potentially make your code run faster
(if you think of new ones, suggest them on the mailing list). (if you think of new ones, suggest them on the mailing list).
Test them first, as they are not guaranteed to always provide a speedup.""", file = file) Test them first, as they are not guaranteed to always provide a speedup.""", file=file)
RandomFunction = theano.tensor.raw_random.RandomFunction RandomFunction = theano.tensor.raw_random.RandomFunction
scal = theano.scalar scal = theano.scalar
...@@ -1309,7 +1310,7 @@ class ProfileStats(object): ...@@ -1309,7 +1310,7 @@ class ProfileStats(object):
return True return True
elif s_op.__class__ not in scalar_op_amdlibm_no_speed_up: elif s_op.__class__ not in scalar_op_amdlibm_no_speed_up:
print("We don't know if amdlibm will accelerate " print("We don't know if amdlibm will accelerate "
"this scalar op.", s_op , file = file) "this scalar op.", s_op, file=file)
return False return False
def exp_float32_op(op): def exp_float32_op(op):
...@@ -1322,7 +1323,7 @@ class ProfileStats(object): ...@@ -1322,7 +1323,7 @@ class ProfileStats(object):
printed_tip = False printed_tip = False
# tip 1 # tip 1
if config.floatX == 'float64': if config.floatX == 'float64':
print(" - Try the Theano flag floatX=float32", file = file) print(" - Try the Theano flag floatX=float32", file=file)
printed_tip = True printed_tip = True
# tip 2 # tip 2
...@@ -1330,7 +1331,7 @@ class ProfileStats(object): ...@@ -1330,7 +1331,7 @@ class ProfileStats(object):
in self.apply_time]): in self.apply_time]):
print(" - Try installing amdlibm and set the Theano flag " print(" - Try installing amdlibm and set the Theano flag "
"lib.amdlibm=True. This speeds up only some Elemwise " "lib.amdlibm=True. This speeds up only some Elemwise "
"operation.", file = file) "operation.", file=file)
printed_tip = True printed_tip = True
# tip 3 # tip 3
...@@ -1339,7 +1340,7 @@ class ProfileStats(object): ...@@ -1339,7 +1340,7 @@ class ProfileStats(object):
for a in self.apply_time]): for a in self.apply_time]):
print(" - With the default gcc libm, exp in float32 is slower " print(" - With the default gcc libm, exp in float32 is slower "
"than in float64! Try Theano flag floatX=float64, or " "than in float64! Try Theano flag floatX=float64, or "
"install amdlibm and set the theano flags lib.amdlibm=True", file = file) "install amdlibm and set the theano flags lib.amdlibm=True", file=file)
printed_tip = True printed_tip = True
# tip 4 # tip 4
...@@ -1352,7 +1353,7 @@ class ProfileStats(object): ...@@ -1352,7 +1353,7 @@ class ProfileStats(object):
" dot22 (which is faster). Make sure the inputs are " " dot22 (which is faster). Make sure the inputs are "
"float32 or float64, and are the same for both inputs. " "float32 or float64, and are the same for both inputs. "
"Currently they are: %s" % "Currently they are: %s" %
[i.type for i in node.inputs], file = file) [i.type for i in node.inputs], file=file)
printed_tip = True printed_tip = True
# tip 5 # tip 5
...@@ -1363,20 +1364,19 @@ class ProfileStats(object): ...@@ -1363,20 +1364,19 @@ class ProfileStats(object):
print(" - Replace the default random number generator by " print(" - Replace the default random number generator by "
"'from theano.sandbox.rng_mrg import MRG_RandomStreams " "'from theano.sandbox.rng_mrg import MRG_RandomStreams "
"as RandomStreams', as this is is faster. It is still " "as RandomStreams', as this is is faster. It is still "
"experimental, but seems to work correctly.", file = file) "experimental, but seems to work correctly.", file=file)
if config.device.startswith("gpu"): if config.device.startswith("gpu"):
print(" - MRG_RandomStreams is the only random number" print(" - MRG_RandomStreams is the only random number"
" generator supported on the GPU.", file = file) " generator supported on the GPU.", file=file)
break break
# tip 6 # tip 6
for a in self.apply_time: for a in self.apply_time:
node = a node = a
if (isinstance(node.op, T.Dot) and if (isinstance(node.op, T.Dot) and len(set(i.dtype for i in node.inputs)) != 1):
len(set(i.dtype for i in node.inputs)) != 1):
print(" - You have a dot operation that has different dtype " print(" - You have a dot operation that has different dtype "
" for inputs (%s). Make sure that the inputs have same " " for inputs (%s). Make sure that the inputs have same "
" dtype." % [i.type for i in node.inputs], file = file) " dtype." % [i.type for i in node.inputs], file=file)
printed_tip = True printed_tip = True
# tip 7 # tip 7
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论