diff --git a/python/jittor/__init__.py b/python/jittor/__init__.py index f2d02734..0fe21624 100644 --- a/python/jittor/__init__.py +++ b/python/jittor/__init__.py @@ -7,7 +7,7 @@ # This file is subject to the terms and conditions defined in # file 'LICENSE.txt', which is part of this source code package. # *************************************************************** -__version__ = '1.2.2.0' +__version__ = '1.2.2.1' from . import lock with lock.lock_scope(): ori_int = int diff --git a/python/jittor/depthwise_conv.py b/python/jittor/depthwise_conv.py index d5f5a222..06ce931f 100644 --- a/python/jittor/depthwise_conv.py +++ b/python/jittor/depthwise_conv.py @@ -308,7 +308,7 @@ class DepthwiseConv(Function): grid = dim3(ksize_width, ksize_height, output_channels); threads = dim3(std::min(output_width, block_size), crop_output_height, 1); - + cudaMemsetAsync(filter_grad_p, 0, filter_grad->size); KernelDepthwiseConvFilterGrad< input_type><<>>( diff --git a/python/jittor/test/system/test_cuda10.0_ubuntu16.04.sh b/python/jittor/test/system/test_cuda10.0_ubuntu16.04.sh index 66aea83f..bb1de201 100644 --- a/python/jittor/test/system/test_cuda10.0_ubuntu16.04.sh +++ b/python/jittor/test/system/test_cuda10.0_ubuntu16.04.sh @@ -28,7 +28,7 @@ RUN pip3 install jittor --timeout 100 && python3.7 -m jittor.test.test_example RUN pip3 uninstall jittor -y COPY . jittor -RUN python3.7 -m pip install jittor +RUN python3.7 -m pip install ./jittor RUN python3.7 -m jittor.test.test_core EOF diff --git a/python/jittor/test/system/test_cuda10.0_ubuntu18.04.sh b/python/jittor/test/system/test_cuda10.0_ubuntu18.04.sh index 02a6ef42..cde38606 100644 --- a/python/jittor/test/system/test_cuda10.0_ubuntu18.04.sh +++ b/python/jittor/test/system/test_cuda10.0_ubuntu18.04.sh @@ -28,7 +28,7 @@ RUN pip3 install jittor --timeout 100 && python3.7 -m jittor.test.test_example RUN pip3 uninstall jittor -y COPY . jittor -RUN python3.7 -m pip install jittor +RUN python3.7 -m pip install ./jittor RUN python3.7 -m jittor.test.test_core EOF diff --git a/python/jittor/test/system/test_cuda11.1_ubuntu16.04.sh b/python/jittor/test/system/test_cuda11.1_ubuntu16.04.sh index ad25f725..0cdbf2f6 100644 --- a/python/jittor/test/system/test_cuda11.1_ubuntu16.04.sh +++ b/python/jittor/test/system/test_cuda11.1_ubuntu16.04.sh @@ -28,7 +28,7 @@ RUN pip3 install jittor --timeout 100 && python3.7 -m jittor.test.test_example RUN pip3 uninstall jittor -y COPY . jittor -RUN python3.7 -m pip install jittor +RUN python3.7 -m pip install ./jittor RUN python3.7 -m jittor.test.test_core EOF diff --git a/python/jittor/test/system/test_cuda11.1_ubuntu18.04.sh b/python/jittor/test/system/test_cuda11.1_ubuntu18.04.sh index 9688dc93..6c8c409f 100644 --- a/python/jittor/test/system/test_cuda11.1_ubuntu18.04.sh +++ b/python/jittor/test/system/test_cuda11.1_ubuntu18.04.sh @@ -28,7 +28,7 @@ RUN pip3 install jittor --timeout 100 && python3.7 -m jittor.test.test_example RUN pip3 uninstall jittor -y COPY . jittor -RUN python3.7 -m pip install jittor +RUN python3.7 -m pip install ./jittor RUN python3.7 -m jittor.test.test_core EOF diff --git a/python/jittor/test/system/test_cuda11.1_ubuntu20.04.sh b/python/jittor/test/system/test_cuda11.1_ubuntu20.04.sh index bd776827..6cc05742 100644 --- a/python/jittor/test/system/test_cuda11.1_ubuntu20.04.sh +++ b/python/jittor/test/system/test_cuda11.1_ubuntu20.04.sh @@ -26,7 +26,7 @@ RUN pip3 install jittor --timeout 100 && python3 -m jittor.test.test_example RUN pip3 uninstall jittor -y COPY . jittor -RUN python3 -m pip install jittor +RUN python3 -m pip install ./jittor RUN python3 -m jittor.test.test_core EOF diff --git a/python/jittor/test/system/test_nocuda_ubuntu18.04.sh b/python/jittor/test/system/test_nocuda_ubuntu18.04.sh index 0cbfe42f..02b83332 100644 --- a/python/jittor/test/system/test_nocuda_ubuntu18.04.sh +++ b/python/jittor/test/system/test_nocuda_ubuntu18.04.sh @@ -28,7 +28,7 @@ RUN pip3 install jittor --timeout 100 && python3.7 -m jittor.test.test_example RUN pip3 uninstall jittor -y COPY . jittor -RUN python3.7 -m pip install jittor +RUN python3.7 -m pip install ./jittor RUN python3.7 -m jittor.test.test_core EOF diff --git a/python/jittor/test/test_depthwise_conv.py b/python/jittor/test/test_depthwise_conv.py index 04465a9f..fe78d531 100644 --- a/python/jittor/test/test_depthwise_conv.py +++ b/python/jittor/test/test_depthwise_conv.py @@ -12,8 +12,8 @@ import numpy as np import jittor.models as jtmodels def load_parameters(m1, m2): - m1.save('temp.pk') - m2.load('temp.pk') + m1.save('/tmp/temp.pk') + m2.load('/tmp/temp.pk') def compare_parameters(m1, m2): ps1 = m1.parameters() @@ -23,7 +23,7 @@ def compare_parameters(m1, m2): y = ps2[i].data + 1e-8 relative_error = abs(x - y) / abs(y) diff = relative_error.mean() - assert diff < 1e-4, (diff, 'backward', ps2[i].name()) + assert diff < 1e-4, (diff, 'backward', ps2[i].name(), ps1[i].mean(), ps1[i].std(), ps2[i].mean(), ps2[i].std()) class TestDepthwiseConv(unittest.TestCase): @unittest.skipIf(not jt.has_cuda, "Cuda not found") @@ -62,15 +62,13 @@ class TestDepthwiseConv(unittest.TestCase): jt_optimizer2 = jt.nn.SGD(jittor_model2.parameters(), lr = lr) jittor_result = jittor_model(jittor_test_img) - loss = jittor_result.sum() + mask = jt.random(jittor_result.shape, jittor_result.dtype) + loss = jittor_result * mask jt_optimizer.step(loss) jt.sync_all(True) jittor_result2 = jittor_model2(jittor_test_img) - loss = jittor_result2.sum() - jt_optimizer2.step(loss) - jt.sync_all(True) - compare_parameters(jittor_model, jittor_model2) + loss = jittor_result2 * mask x = jittor_result2.data + 1e-8 y = jittor_result.data + 1e-8 @@ -78,6 +76,11 @@ class TestDepthwiseConv(unittest.TestCase): diff = relative_error.mean() assert diff < 1e-4, (diff, 'forword') + jt_optimizer2.step(loss) + jt.sync_all(True) + compare_parameters(jittor_model, jittor_model2) + + jt.clean() jt.gc()