When I use cudnnGetRNNWorkspaceSize,segmentation fault

Now I am learning LSTM.I use the cudnn-7.5-v5 to write the cores,when I use the cudnnGetRNNWorkSpaceSize,return segmentation fault.But I use the cudnnGetRNNParamsSize,return success.This two function use the same arguments,why return different results? And whyworkspace size return fault? Some arguments of the LSTM are following:

size_t workspaceSize, paramsSize;
      int hiddenSize = 5, seqLength = 5, numLayers = 1;
      cudnnTensorDescriptor_t xDesc[5];
      for(int i = 0; i < seqLength, i++){
          dimA[0] = 5, dimA[1] = 5, dimA[2] = 1;
          strideA[0] = dimA[2] * dimA[1];
          strideA[1] = dimA[2];
          strideA[2] = 1;
          cudnnSetTesorNdDescriptor(xDesc[i], dataType, 3, dimA, strideA);
      cudnnSetRNNDescriptor(rnnDesc, hiddenSize, seqLength, numLayers, 0, inputMode, dirMode, rnnMode, dataType);
      cudnnGetRNNWspaceSize(handle, rnnDesc, xDesc, &workspaceSize);
      cudnnGetRNNWParamsSize(handle, rnnDesc, xDesc, &paramsSize);

Thanak you for your attention!