提交 f789222d authored 作者: Roy Xue's avatar Roy Xue

add nodes_mem in count_running_memory method

(last time Travis occurs an error about this, fix now)
上级 8e42f3f9
...@@ -629,7 +629,7 @@ class ProfileStats(object): ...@@ -629,7 +629,7 @@ class ProfileStats(object):
max_node_memory_saved_by_view = 0 max_node_memory_saved_by_view = 0
max_node_memory_saved_by_inplace = 0 max_node_memory_saved_by_inplace = 0
def count_running_memory(order, old_storage): def count_running_memory(order, old_storage, nodes_mem):
for node in order: for node in order:
val = nodes_mem[node] val = nodes_mem[node]
dmap = getattr(node.op, 'destroy_map', None) dmap = getattr(node.op, 'destroy_map', None)
...@@ -701,14 +701,14 @@ class ProfileStats(object): ...@@ -701,14 +701,14 @@ class ProfileStats(object):
if (input in computed) and if (input in computed) and
(input not in fgraph.outputs) and (input not in fgraph.outputs) and
node == last_user[input]]) node == last_user[input]])
node_memory_size, running_memory_size, running_max_memory_size, node_memory_saved_by_view, node_memory_saved_by_inplace = count_running_memory(order, post_thunk_old_storage) node_memory_size, running_memory_size, running_max_memory_size, node_memory_saved_by_view, node_memory_saved_by_inplace = count_running_memory(order, post_thunk_old_storage, nodes_mem)
new_order = fgraph.profile.node_executed_order new_order = fgraph.profile.node_executed_order
# A list of new executed node order # A list of new executed node order
new_storage = fgraph.profile.node_cleared_order new_storage = fgraph.profile.node_cleared_order
# A list of variables that get freed # A list of variables that get freed
new_node_memory_size, new_running_memory_size, new_running_max_memory_size, new_node_memory_saved_by_view, new_node_memory_saved_by_inplace = count_running_memory(new_order, new_storage) new_node_memory_size, new_running_memory_size, new_running_max_memory_size, new_node_memory_saved_by_view, new_node_memory_saved_by_inplace = count_running_memory(new_order, new_storage, nodes_mem)
# 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)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论