Skip to content

Commit

Permalink
Fix mx.symbol.numpy._Symbol.__deepcopy__ logic error (apache#18686)
Browse files Browse the repository at this point in the history
* Fix mx.symbol.numpy._Symbol.__deepcopy__ logic error

Performed shallow copy instead of deep copy

* Test

* Fix test
  • Loading branch information
leezu committed Jul 22, 2020
1 parent 9548b0c commit a330a02
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/python/unittest/test_symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,3 +479,13 @@ def test_infershape_happens_for_all_ops_in_graph():

assert False

def test_symbol_copy():
a = mx.sym.Variable('a')
b = copy.copy(a)
b._set_attr(name='b')
assert a.name == 'a' and b.name == 'b'

a = mx.sym.Variable('a').as_np_ndarray()
b = copy.copy(a)
b._set_attr(name='b')
assert a.name == 'a' and b.name == 'b'

0 comments on commit a330a02

Please sign in to comment.