Imported from https://github.com/mjhucla/TF-mRNN