You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@singa.apache.org by sh...@apache.org on 2020/07/14 10:04:34 UTC

[singa] branch dev updated: update from deprecated functions

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

shicong pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/singa.git


The following commit(s) were added to refs/heads/dev by this push:
     new 7ac6804  update from deprecated functions
     new 2c08b40  Merge pull request #766 from chrishkchris/testfix
7ac6804 is described below

commit 7ac68049c5b5bc0c234f4c373c6fbefb32a66ded
Author: Chris Yeung <ch...@yahoo.com.hk>
AuthorDate: Tue Jul 14 12:19:44 2020 +0800

    update from deprecated functions
    
    fix wrong position of skip gpu argument
    
    fix typo of function name
    
    delete lines
---
 python/singa/device.py     | 2 +-
 test/python/test_onnx.py   | 8 ++++----
 test/python/test_tensor.py | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/python/singa/device.py b/python/singa/device.py
index 39a4e0f..3c8f8fc 100644
--- a/python/singa/device.py
+++ b/python/singa/device.py
@@ -132,5 +132,5 @@ def get_default_device():
     return default_device
 
 
-def enbale_lazy_alloc(enable):
+def enable_lazy_alloc(enable):
     singa.Device.EnableLazyAlloc(enable)
diff --git a/test/python/test_onnx.py b/test/python/test_onnx.py
index 4807105..5d65be6 100644
--- a/test/python/test_onnx.py
+++ b/test/python/test_onnx.py
@@ -2031,7 +2031,7 @@ class TestPythonOnnx(unittest.TestCase):
         # backward
         sgd = opt.SGD(lr=0.01)
         for p, gp in autograd.backward(loss):
-            sgd.update(p, gp)
+            sgd.apply(p.name, p, gp)
         sgd.step()
 
         # frontend
@@ -2047,7 +2047,7 @@ class TestPythonOnnx(unittest.TestCase):
         loss = autograd.MeanSquareError()(y_o, y_t)[0]
         sgd = opt.SGD(lr=0.01)
         for p, gp in autograd.backward(loss):
-            sgd.update(p, gp)
+            sgd.apply(p.name, p, gp)
         sgd.step()
 
     def test_retraining_cpu(self):
@@ -2080,7 +2080,7 @@ class TestPythonOnnx(unittest.TestCase):
         # backward
         sgd = opt.SGD(lr=0.01)
         for p, gp in autograd.backward(loss):
-            sgd.update(p, gp)
+            sgd.apply(p.name, p, gp)
         sgd.step()
 
         # frontend
@@ -2113,7 +2113,7 @@ class TestPythonOnnx(unittest.TestCase):
         loss = autograd.MeanSquareError()(y_o, y_ot)[0]
         sgd = opt.SGD(lr=0.01)
         for p, gp in autograd.backward(loss):
-            sgd.update(p, gp)
+            sgd.apply(p.name, p, gp)
         sgd.step()
 
     def test_transfer_learning_cpu(self):
diff --git a/test/python/test_tensor.py b/test/python/test_tensor.py
index ec989ee..9bf81da 100644
--- a/test/python/test_tensor.py
+++ b/test/python/test_tensor.py
@@ -534,10 +534,10 @@ class TestTensorMethods(unittest.TestCase):
         y = ta - tb
         np.testing.assert_array_almost_equal(tensor.to_numpy(y), a_np - b_np)
 
-    @unittest.skipIf(not singa_api.USE_CUDA, 'CUDA is not enabled')
     def test_kint_kint_cpu(self, dev=cpu_dev):
         self._kint_kint(cpu_dev)
 
+    @unittest.skipIf(not singa_api.USE_CUDA, 'CUDA is not enabled')
     def test_kint_kint_gpu(self, dev=gpu_dev):
         self._kint_kint(gpu_dev)
 
@@ -559,10 +559,10 @@ class TestTensorMethods(unittest.TestCase):
         y = ta - tb
         np.testing.assert_array_almost_equal(tensor.to_numpy(y), a_np - b_np)
 
-    @unittest.skipIf(not singa_api.USE_CUDA, 'CUDA is not enabled')
     def test_kint_kint_bc_cpu(self, dev=cpu_dev):
         self._kint_kint_bc(cpu_dev)
 
+    @unittest.skipIf(not singa_api.USE_CUDA, 'CUDA is not enabled')
     def test_kint_kint_bc_gpu(self, dev=gpu_dev):
         self._kint_kint_bc(gpu_dev)