Last active
September 21, 2016 14:39
-
-
Save hughperkins/98243072eafe24b8b9f919a306fe9d07 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ py.test -sv test/test_inline_refcount.py -k test2 | |
| ============================= test session starts ============================== | |
| platform linux2 -- Python 2.7.11+, pytest-2.9.2, py-1.4.31, pluggy-0.3.1 -- [deleted]/bin/python2.7 | |
| cachedir: .cache | |
| rootdir: [deleted]/pytorch, inifile: pytest.ini | |
| plugins: pep8-1.0.6 | |
| collecting ... collected 3 items | |
| test/test_inline_refcount.py::test_inline_refcount_test2 <TestInlineRefCount> initialization | |
| allocating npv | |
| npv ref 2 | |
| after gc | |
| npv ref 2 | |
| npv.data ref 1 | |
| after get np.vdata | |
| npv ref 3 | |
| npv_data ref 2 | |
| type(npv_data) <type 'buffer'> | |
| after assign npv2 | |
| npv ref 3 | |
| npv2 ref 2 | |
| npv_data ref 2 | |
| npv2.data ref 1 | |
| after set npv2 None, and gc | |
| npv ref 3 | |
| npv_data ref 2 | |
| doing lua_obj.set(npv) | |
| _FloatTensor.__cinit__ _allocate False | |
| assigning to tensor.nparray | |
| increfing self.nparray | |
| _FloatTensor.__dealloc, nparray [ 0. 1. 2. 3. 4. 5. 6. 7. 8. 9.] | |
| decrefing nparray | |
| _FloatTensor.__dealloc calling free | |
| npv ref 3 | |
| npv_data ref 2 | |
| _FloatTensor.__cinit__ _allocate False | |
| _FloatTensor.__dealloc, nparray None | |
| _FloatTensor.__dealloc calling free | |
| _FloatTensor.__cinit__ _allocate False | |
| assigning to tensor.nparray | |
| increfing self.nparray | |
| _FloatTensor.__dealloc, nparray [ 0. 2. 4. 6. 8. 10. 12. 14. 16. 18.] | |
| decrefing nparray | |
| _FloatTensor.__dealloc calling free | |
| _FloatTensor.__cinit__ _allocate False | |
| _FloatTensor.__dealloc, nparray None | |
| _FloatTensor.__dealloc calling free | |
| _FloatTensor.__cinit__ _allocate False | |
| assigning to tensor.nparray | |
| increfing self.nparray | |
| _FloatTensor.__dealloc, nparray [ 0. 3. 6. 9. 12. 15. 18. 21. 24. 27.] | |
| decrefing nparray | |
| _FloatTensor.__dealloc calling free | |
| _FloatTensor.__cinit__ _allocate False | |
| _FloatTensor.__dealloc, nparray None | |
| _FloatTensor.__dealloc calling free | |
| _FloatTensor.__cinit__ _allocate False | |
| _FloatTensor.__dealloc, nparray None | |
| _FloatTensor.__dealloc calling free | |
| allocate simple array of zeros, this overwrites lua_obj.v :-P | |
| _FloatTensor.__cinit__ _allocate False | |
| _FloatTensor.__dealloc, nparray None | |
| _FloatTensor.__dealloc calling free | |
| FAILED | |
| --- generated xml file: [deleted]/pytorch/test/junit-pytest-report.xml --- | |
| =========================== short test summary info ============================ | |
| FAIL test/test_inline_refcount.py::test_inline_refcount_test2 | |
| =================================== FAILURES =================================== | |
| __________________________ test_inline_refcount_test2 __________________________ | |
| def test_inline_refcount_test2(): | |
| TestInlineRefCount = PyTorchHelpers.load_lua_class('test/test_inline_refcount.lua', 'TestInlineRefCount') | |
| lua_obj = TestInlineRefCount() | |
| # v = list(range(10)) | |
| # print('v ref', sys.getrefcount(v)) | |
| print('\nallocating npv') | |
| npv = np.asarray(list(range(10)), dtype=np.float32) | |
| # print('v ref', sys.getrefcount(v)) | |
| print('npv ref', sys.getrefcount(npv)) | |
| gc.collect() | |
| print('\nafter gc') | |
| print('npv ref', sys.getrefcount(npv)) | |
| print('npv.data ref', sys.getrefcount(npv.data)) | |
| npv_data = npv.data | |
| print('\nafter get np.vdata') | |
| # print('v ref', sys.getrefcount(v)) | |
| print('npv ref', sys.getrefcount(npv)) | |
| print('npv_data ref', sys.getrefcount(npv_data)) | |
| print('type(npv_data)', type(npv_data)) | |
| # npv_data_str = 'npv_data ' | |
| # for value in npv_data: | |
| # npv_data_str += ' ' + int(value) | |
| # print(npv_data_str) | |
| # print('npv_data', npv_data) | |
| npv2 = npv * 2 | |
| print('\nafter assign npv2') | |
| # print('v ref', sys.getrefcount(v)) | |
| print('npv ref', sys.getrefcount(npv)) | |
| print('npv2 ref', sys.getrefcount(npv2)) | |
| print('npv_data ref', sys.getrefcount(npv_data)) | |
| print('npv2.data ref', sys.getrefcount(npv2.data)) | |
| npv2 = None | |
| gc.collect() | |
| print('\nafter set npv2 None, and gc') | |
| # print('v ref', sys.getrefcount(v)) | |
| print('npv ref', sys.getrefcount(npv)) | |
| print('npv_data ref', sys.getrefcount(npv_data)) | |
| print('\ndoing lua_obj.set(npv)') | |
| lua_obj.set(npv) | |
| # print('v ref', sys.getrefcount(v)) | |
| print('npv ref', sys.getrefcount(npv)) | |
| print('npv_data ref', sys.getrefcount(npv_data)) | |
| assert lua_obj.v[1] != 0 | |
| assert npv[1] != 0 | |
| npv2 = npv * 2 | |
| lua_obj.set(npv2) | |
| assert lua_obj.v[1] != 0 | |
| assert npv[1] != 0 | |
| lua_obj.set(npv * 3) | |
| assert lua_obj.v[1] != 0 | |
| assert npv[1] != 0 | |
| assert npv[1] != 0 | |
| assert lua_obj.v[1] != 0 | |
| print('allocate simple array of zeros, this overwrites lua_obj.v :-P') | |
| np.zeros(10, dtype=np.float32) | |
| print('') | |
| assert npv[1] != 0 | |
| > assert lua_obj.v[1] != 0 | |
| E assert 0.0 != 0 | |
| test/test_inline_refcount.py:98: AssertionError | |
| ======================= 2 tests deselected by '-ktest2' ======================== | |
| ==================== 1 failed, 2 deselected in 0.46 seconds ==================== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment