code: public SDVariable var(@NonNull final SDVariable v) {
          if (variables.containsKey(v.getVarName()) && variables.get(v.getVarName()).getVariable().getArr() != null)
              return variables.get(v.getVarName()).getVariable();
  
          if (v.getVarName() == null || v.getVarName().length() < 1)
              throw new IllegalArgumentException("Name for variable must be defined");
  
          VariableType vt = v.getVariableType();
          NDArraySupplierInitScheme s = null;
          switch(vt){
              case VARIABLE:
                  s = new NDArraySupplierInitScheme(v.getArr());
                  //Intentional fallthrough
              case ARRAY:
                  SDVariable ret = new SDVariable(v.getVarName(), v.getVariableType(), this, v.getShape(), v.dataType(), s);
                  return addVariable(ret);
              case CONSTANT:
                  return constant(v.getVarName(), v.getArr());
              case PLACEHOLDER:
                  return placeHolder(v.getVarName(), v.dataType(), v.placeholderShape());
              default:
                  throw new RuntimeException("Unknown/not supported variable type: " + vt);
          }
      }
docs: Initialize a {@link SDVariable} reference tying this variable to this samediff instance.
  <p>
  {@link NDArraySupplierInitScheme} is used to ensure that if the array is allocated anywhere
  and {@link SameDiff} instance to exist as a copy of the variable.
  
  @param v Variable
  @return