Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Change the naming
Browse files Browse the repository at this point in the history
  • Loading branch information
ArmageddonKnight committed Sep 16, 2020
1 parent c1244dc commit 48af65e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 10 additions & 2 deletions src/imperative/imperative.cc
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,11 @@ void Imperative::RecordOp(

nnvm::ObjectPtr node = nnvm::Node::Create();
node->attrs = std::move(attrs);
node->attrs.name = "node_" + std::to_string(node_count_++);
if (node->attrs.name == "") {
node->attrs.name = "node_" + std::to_string(node_count_++);
} else {
node_count_++;
}
AGInfo& info = AGInfo::Create(node);
info.state = state;
info.ctx = outputs[0]->ctx();
Expand Down Expand Up @@ -322,7 +326,11 @@ void Imperative::RecordDeferredCompute(nnvm::NodeAttrs &&attrs,
}
node->attrs = std::move(attrs);
// Need to support NameManager in imperative API to better name node->attrs.name
node->attrs.name = "node_" + std::to_string(node_count_++);
if (node->attrs.name == "") {
node->attrs.name = "node_" + std::to_string(node_count_++);
} else {
node_count_++;
}

for (uint32_t i = 0; i < outputs.size(); ++i) {
outputs[i]->deferredcompute_entry_ = nnvm::NodeEntry{node, i, 0};
Expand Down
6 changes: 3 additions & 3 deletions tests/python/gpu/test_profiler_gpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_gpu_memory_profiler_symbolic():
with profiler.scope("tensordot"):
A = mx.sym.Variable('A')
B = mx.sym.Variable('B')
C = mx.symbol.dot(A, B)
C = mx.symbol.dot(A, B, name="dot")

executor = C._simple_bind(mx.gpu(), 'write', A=(1024, 2048), B=(2048, 4096))

Expand All @@ -62,7 +62,7 @@ def test_gpu_memory_profiler_symbolic():
'Requested Size' : str(4 * a.size)},
{'Attribute Name' : 'tensordot:in_arg:B',
'Requested Size' : str(4 * b.size)},
{'Attribute Name' : 'tensordot:dot0',
{'Attribute Name' : 'tensordot:dot',
'Requested Size' : str(4 * c.size)},
{'Attribute Name' : 'init:_random_uniform',
'Requested Size' : str(4 * a.size)},
Expand All @@ -77,7 +77,7 @@ def test_gpu_memory_profiler_symbolic():
# resource:temp_space (sample_op.h +365),8,0,4096,0
# symbol:arg_grad:unknown,8388608,0,8388608,0
# symbol:arg_grad:unknown,33554432,0,33554432,0
# tensordot:dot0,16777216,0,16777216,0
# tensordot:dot,16777216,0,16777216,0
# tensordot:in_arg:A,8388608,0,8388608,0
# tensordot:in_arg:B,33554432,0,33554432,0
# tensordot:node_0_backward,33554432,0,33554432,0
Expand Down

0 comments on commit 48af65e

Please sign in to comment.