docs: public SDVariable getGradForVariable(String varName) {
          Preconditions.checkState(variables.containsKey(varName), "No variable with name \"%s\" exists", varName);
          SDVariable v = getVariable(varName);
          Preconditions.checkState(v.dataType().isFPType(), "Cannot get gradient of %s variable \"%s\": only floating" +
                  " point variables have gradients", varName, v.dataType());
          //Gradients are being placed in the inner "grad" function SameDiff instance, but not the outer one
          if (variables.containsKey(varName) && variables.get(varName).getGradient() != null) {
              return variables.get(varName).getGradient();
          } else if(sameDiffFunctionInstances.containsKey("grad") && sameDiffFunctionInstances.get("grad").variables.containsKey(varName)){
              return sameDiffFunctionInstances.get("grad").variables.get(varName).getGradient();
          }
          return null;
      }