code: public void rnnClearPreviousState() {
          if (layers == null)
              return;
          for (int i = 0; i < layers.length; i++) {
              if (layers[i] instanceof RecurrentLayer)
                  ((RecurrentLayer) layers[i]).rnnClearPreviousState();
              else if (layers[i] instanceof MultiLayerNetwork) {
                  ((MultiLayerNetwork) layers[i]).rnnClearPreviousState();
              } else if(layers[i] instanceof BaseWrapperLayer && ((BaseWrapperLayer)layers[i]).getUnderlying() instanceof RecurrentLayer){
                  ((RecurrentLayer) ((BaseWrapperLayer)layers[i]).getUnderlying()).rnnClearPreviousState();
              }
          }
      }
docs: Clear the previous state of the RNN layers (if any).