code: public static INDArray reverseTimeSeriesMask(INDArray mask){
          if(mask == null){
              return null;
          }
          if(mask.rank() == 3){
              //Should normally not be used - but handle the per-output masking case
              return reverseTimeSeries(mask);
          } else if(mask.rank() != 2){
              throw new IllegalArgumentException("Invalid mask rank: must be rank 2 or 3. Got rank " + mask.rank()
                      + " with shape " + Arrays.toString(mask.shape()));
          }
  
          // FIXME: int cast
          int[] idxs = new int[(int) mask.size(1)];
          int j=0;
          for( int i=idxs.length-1; i>=0; i--){
              idxs[j++] = i;
          }
  
          return Nd4j.pullRows(mask, 0, idxs);
      }
docs: Reverse a (per time step) time series mask, with shape [minibatch, timeSeriesLength]
  @param mask Mask to reverse along time dimension
  @return Mask after reversing