Persistent RNN Cells
Dear @tqchen , Im trying to implement RNN Cells for darknet front end, but i have an issue which need your support.
In RNN, the complete "network" needs to be run multiple times to get the next output. I need to preserve the RNN cell state across multiple iterations of the network.
Is there any way to preserve the state and can be used for the next iteration? I saw cache_read and cache_write in schedule? Whether this can be used to preserve the state? If so, how to use that?
I don't know what the 'best' way to do this is, but you could have the RNN cell's new updated hidden state as an output to your computation so you can feed that in on the next time step
see https://github.com/dmlc/tvm/tree/master/topi/recipe/rnn for some recipe
BTW, since this is a community project, you do not have to specifically at me to ask questions :)
@alex-weaver I will have multiple RNN Cells with different output size.. so its little difficult to keep track of all the outputs, again feeding at input..
what is global/shared/local cache? if i use global, the values will be preserved for the entire lifespan?
the memory scope only has things to do with their location on thread scope. We do support multiple input and states in the scan operator, which gives the lstm example here
Any idea why this error is happenning while executing matexp.py?
The same script was running before and now im getting this error.
File "matexp.py", line 152, in <module>
rnn_matexp()
File "matexp.py", line 149, in rnn_matexp
check_device("cuda")
File "matexp.py", line 117, in check_device
f = tvm.build(s, [s_scan, Whh], target)
File "/home/siju/.local/lib/python3.6/site-packages/tvm-0.2.0-py3.6-linux-x86_64.egg/tvm/build_module.py", line 449, in build
mdev = codegen.build_module(fdevice, str(target_device))
File "/home/siju/.local/lib/python3.6/site-packages/tvm-0.2.0-py3.6-linux-x86_64.egg/tvm/codegen.py", line 20, in build_module
return _Build(lowered_func, target)
File "/home/siju/.local/lib/python3.6/site-packages/tvm-0.2.0-py3.6-linux-x86_64.egg/tvm/_ffi/function.py", line 255, in my_api_func
return flocal(*args)
File "tvm/_ffi/_cython/./function.pxi", line 264, in core.FunctionBase.__call__
File "tvm/_ffi/_cython/./function.pxi", line 213, in core.FuncCall
File "tvm/_ffi/_cython/./function.pxi", line 205, in core.FuncCall3
File "tvm/_ffi/_cython/./base.pxi", line 131, in core.CALL
tvm._ffi.base.TVMError: b'TVMCall CFunc Error:\nTraceback (most recent call last):\n File "tvm/_ffi/_cython/./function.pxi", line 39, in core.tvm_callback\n File "matexp.py", line 27, in tvm_callback_cuda_compile\n ptx = nvcc.compile_cuda(code, target="ptx")\n File "/home/siju/.local/lib/python3.6/site-packages/tvm-0.2.0-py3.6-linux-x86_64.egg/tvm/contrib/nvcc.py", line 69, in compile_cuda\n cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)\n File "/home/siju/anaconda3/lib/python3.6/subprocess.py", line 709, in __init__\n restore_signals, start_new_session)\n File "/home/siju/anaconda3/lib/python3.6/subprocess.py", line 1344, in _execute_child\n raise child_exception_type(errno_num, err_msg, err_filename)\nFileNotFoundError: [Errno 2] No such file or directory: \'nvcc\': \'nvcc\'\n'
look at the error message, it says nvcc not available, put cuda bin to your path
cuda/bin path is already given as part of make/config.mk the other examples can run fine (the ones in tutorials folder).. except matexp.py
siju@siju-DAEMON:~/D/Community/nnvm/tvm/topi/recipe/rnn$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Tue_Jan_10_13:22:03_CST_2017
Cuda compilation tools, release 8.0, V8.0.61
siju@siju-DAEMON:~/D/Community/nnvm/tvm/topi/recipe/rnn$ cat ../../../make/config.mk | grep CUDA
# whether enable CUDA during compile
USE_CUDA = 1
# add the path to CUDA library to link and compile flag
CUDA_PATH = /usr/local/cuda-8.0
siju@siju-DAEMON:~/D/Community/nnvm/tvm/topi/recipe/rnn$
This is the runtime(nvcc compiler) that requires the cuda path, you need to do that by
export PATH=${PATH}:/usr/local/cuda/bin
:+1: Yeah. Thanks a lot. I forgot to set this path after rebooting.
please close this for now as the original issue has been answered, we prefer to aggressively close issues and open new ones when necessary so there is minimum amount of issues, and the community won't forget about them