code: public static String validate(OpTestCase testCase) {
          collectCoverageInformation(testCase);
  
          //Check shape function:
          List<LongShapeDescriptor> outShapes;
          try {
              outShapes = Nd4j.getExecutioner().calculateOutputShape(testCase.op());
          } catch (Throwable t) {
              throw new IllegalStateException("Error calculating output shapes during op validation", t);
          }
  
          if (outShapes.size() != testCase.testFns().size()) {
              return "Expected number of output shapes and number of outputs differ. " + outShapes.size() + " output shapes," +
                      " but OpTestCase specifies " + testCase.testFns().size() + " outputs expected";
          }
  
          for (int i = 0; i < outShapes.size(); i++) {
              val act = outShapes.get(i);
              val exp = testCase.expShapes().get(i);
              if(!Objects.equals(exp.dataType(), act.dataType())){
                  return "Shape function check failed for output " + i + ": expected shape " + exp + ", actual shape " + act;
              }
              if(!Arrays.equals(act.getShape(), exp.getShape())){
                  return "Shape function check failed for output " + i + ": expected shape " + exp + ", actual shape " + act;
              }
          }
  
          //Check the outputs:
          try {
              Nd4j.getExecutioner().execAndReturn(testCase.op());
          } catch (Throwable t) {
              throw new IllegalStateException("Error during op execution", t);
          }
  
          for (int i = 0; i < testCase.testFns().size(); i++) {
              String error;
              try {
                  error = testCase.testFns().get(i).apply(testCase.op().outputArguments()[i]);
              } catch (Throwable t) {
                  throw new IllegalStateException("Exception thrown during op output validation for output " + i, t);
              }
  
              if (error != null) {
                  return "Output " + i + " failed: " + error;
              }
          }
  
          return null;    //OK
      }
docs: Validate the outputs of a single op
  
  @param testCase Op test case to run
  @return NULL if test is OK, or an error message otherwise