how to modify rnn cells in pytorch?
If I want to change the compute rules in a RNN cell (e.g. GRU cell), what should I do?
I do not want to implement it via for or while loop considering the issue of efficiency.
I have viewed the source code of pytorch, but it seems that the major components of rnn cells are implement in c code which I cannot find and modify.
You can answer this question through an example: implement GRU cell without the existing version.

thank you ~

Yes, you implement it "via for or while loop".
Since Pytorch 1.0 there is JIT https://pytorch.org/docs/stable/jit.html that works pretty well (probably better to use the latest git version of PyTorch because of recent improvements to JIT), and depending on your network and implementation in can as fast as a native PyTorch C++ implementation (but still slower than CuDNN). 

You can see example implementations at https://github.com/pytorch/benchmark/blob/master/rnns/fastrnns/custom_lstms.py
