You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by zh...@apache.org on 2020/07/22 06:33:19 UTC

[incubator-mxnet] branch master updated: Fix mx.symbol.numpy._Symbol.__deepcopy__ logic error (#18686)

This is an automated email from the ASF dual-hosted git repository.

zhasheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new a330a02  Fix mx.symbol.numpy._Symbol.__deepcopy__ logic error (#18686)
a330a02 is described below

commit a330a022d4c32b9096c4b6d7066a936d6eef59a1
Author: Leonard Lausen <la...@amazon.com>
AuthorDate: Wed Jul 22 06:31:47 2020 +0000

    Fix mx.symbol.numpy._Symbol.__deepcopy__ logic error (#18686)
    
    * Fix mx.symbol.numpy._Symbol.__deepcopy__ logic error
    
    Performed shallow copy instead of deep copy
    
    * Test
    
    * Fix test
---
 tests/python/unittest/test_symbol.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tests/python/unittest/test_symbol.py b/tests/python/unittest/test_symbol.py
index 1c84af0..910b6ca 100644
--- a/tests/python/unittest/test_symbol.py
+++ b/tests/python/unittest/test_symbol.py
@@ -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'