Adds incoming arguments for the specified differential function to the graph

@param variables Name of the variables that are arguments (inputs) to the specified function
@param function  Function
516532
public void addArgsFor(String[] variables, DifferentialFunction function) {
        if (function.getOwnName() == null)
            throw new ND4JIllegalStateException("Instance id can not be null. Function not initialized properly");

        //double check if function contains placeholder args
        for (val varName : variables) {
            if (isPlaceHolder(varName)) {
                placeHolderFunctions.add(function.getOwnName());
            }
        }

        //Add function if it doesn't exist
        //TODO could "not existing" be a bug sometimes?
        if(!ops.containsKey(function.getOwnName())){
            ops.put(function.getOwnName(), SameDiffOp.builder().name(function.getOwnName()).op(function).build());
        }

        //Update variable 'inputs to op' accounting for repeated inputs (like y = x+x)
        ops.get(function.getOwnName()).setInputsToOp(Arrays.asList(variables));     //Duplicate variables OK/required here

        for (String variableName : variables) {
            List<String> funcs = this.variables.get(variableName).getInputsForOp();
            if (funcs == null) {
                funcs = new ArrayList<>();
                this.variables.get(variableName).setInputsForOp(funcs);
            }
            if(!funcs.contains(function.getOwnName()))  //Avoid duplicates for function names.
                funcs.add(function.getOwnName());
        }
    }
486985
void add(final Argument argument) {
        if (argument != null) {
            if (argument.multipleValuesAllowed()) {
                Collection<Argument> arguments = map.get(argument.getKey());
                if (arguments == null) {
                    arguments = new ArrayList<>();
                    map.put(argument.getKey(), arguments);
                }
                arguments.add(argument);
            } else {
                set(argument);
            }
        }
    }
1289237
public SystemInputDefBuilder functions( FunctionInputDef... functions)
    {
    for( FunctionInputDef function : functions)
      {
      systemInputDef_.addFunctionInputDef( function);
      }
    return this;
    }
396917
private void compute(final List<Integer> variables) {
        final Stack<Integer> candidates = createInitialCandidates(variables);
        while (candidates.size() > 0) {
            final int lit = candidates.pop();
            if (solve(lit)) {
                refineUpperBound();
            } else {
                addBackboneLiteral(lit);
            }
        }
    }
1154559
public void addQuad(final String subject, final String predicate, final String object,
            String graph) {
        if (graph == null) {
            graph = "@default";
        }
        if (!containsKey(graph)) {
            put(graph, new ArrayList<Quad>());
        }
        ((ArrayList<Quad>) get(graph)).add(new Quad(subject, predicate, object, graph));
    }
277410
public void initFunctionFromProperties(String mappedTfName, DifferentialFunction on, Map<String, OnnxProto3.AttributeProto> attributesForNode, OnnxProto3.NodeProto node, OnnxProto3.GraphProto graph) {
        val properties = on.mappingsForFunction();
        val tfProperties = properties.get(mappedTfName);
        val fields = DifferentialFunctionClassHolder.getInstance().getFieldsForFunction(on);
        val attributeAdapters = on.attributeAdaptersForFunction();
        for(val entry : tfProperties.entrySet()) {
            val tfAttrName = entry.getValue().getTfAttrName();
            val currentField = fields.get(entry.getKey());

            AttributeAdapter adapter = null;
            if(tfAttrName != null) {
                if(currentField == null) {
                    continue;
                }
                if(attributeAdapters != null && !attributeAdapters.isEmpty()) {
                    val mappers = attributeAdapters.get(on.tensorflowName());
                    val adapterFor = mappers.get(entry.getKey());
                    adapter = adapterFor;
                }


                if(attributesForNode.containsKey(tfAttrName)) {
                    val attr = attributesForNode.get(tfAttrName);
                    switch (attr.getType()) {
                        case STRING:
                            val setString = attr.getS().toStringUtf8();
                            if(adapter != null) {
                                adapter.mapAttributeFor(setString,currentField,on);
                            }
                            else
                                on.setValueFor(currentField,setString);
                            break;
                        case INT:
                            val setInt = (int) attr.getI();
                            if(adapter != null) {
                                adapter.mapAttributeFor(setInt,currentField,on);
                            }
                            else
                                on.setValueFor(currentField,setInt);
                            break;
                        case INTS:
                            val setList = attr.getIntsList();
                            if(!setList.isEmpty()) {
                                val intList = Ints.toArray(setList);
                                if(adapter != null) {
                                    adapter.mapAttributeFor(intList,currentField,on);
                                }
                                else
                                    on.setValueFor(currentField,intList);
                            }
                            break;
                        case FLOATS:
                            val floatsList = attr.getFloatsList();
                            if(!floatsList.isEmpty()) {
                                val floats = Floats.toArray(floatsList);
                                if(adapter != null) {
                                    adapter.mapAttributeFor(floats,currentField,on);
                                }

                                else
                                    on.setValueFor(currentField,floats);
                                break;
                            }
                            break;
                        case TENSOR:
                            val tensorToGet = mapTensorProto(attr.getT());
                            if(adapter != null) {
                                adapter.mapAttributeFor(tensorToGet,currentField,on);
                            }
                            else
                                on.setValueFor(currentField,tensorToGet);
                            break;

                    }
                }
            }


        }
    }
1182298
def arguments(function, extra_arguments=0):
    """"""
    if not hasattr(function, '__code__'):
        return ()

    return function.__code__.co_varnames[:function.__code__.co_argcount + extra_arguments]
1139182
private static FunctionInputDef asFunctionInputDef( String functionName, JsonObject json)
    {
    FunctionInputDef functionInputDef;

    try
      {
      functionInputDef = new FunctionInputDef( validIdentifier( functionName));
      
      // Get function annotations
      Optional.ofNullable( json.getJsonObject( HAS_KEY))
        .ifPresent( has -> has.keySet().stream().forEach( key -> functionInputDef.setAnnotation( key, has.getString( key))));

      // Get function variables.
      json.keySet().stream()
        .filter( key -> !key.equals( HAS_KEY))
        .forEach( varType -> getVarDefs( varType, json.getJsonObject( varType)).forEach( varDef -> functionInputDef.addVarDef( varDef)));

      if( functionInputDef.getVarTypes().length == 0)
        {
        throw new SystemInputException( String.format( "No variables defined for function=%s", functionName));
        }

      SystemInputs.getPropertiesUndefined( functionInputDef)
        .entrySet().stream()
        .findFirst()
        .ifPresent( undefined -> {
          String property = undefined.getKey();
          IConditional ref = undefined.getValue().stream().findFirst().orElse( null);
          throw new SystemInputException
            ( String.format
              ( "Property=%s is undefined, but referenced by %s",
                property,
                SystemInputs.getReferenceName( ref)));
          });

      }
    catch( SystemInputException e)
      {
      throw new SystemInputException( String.format( "Error defining function=%s", functionName), e);
      }
    
    return functionInputDef;
    }
1322066
private void addToUsedVariables(final java.util.List<VariableAndValue> usedVariables, final MethodAndParameter top, final Variable variable) {
        VariableAndValue variableAndValue = new VariableAndValue(variable, top.getParameter());
        if (!usedVariables.contains(variableAndValue)) {
            usedVariables.add(variableAndValue);
        } else {
            int i = 0;
            do {
                i++;
                variableAndValue = new VariableAndValue(
                        new Variable(
                                elementUtils.getName(variable.getName().toString() + i),
                                variable.getType()
                        ),
                        top.getParameter()
                );
            } while (usedVariables.contains(variableAndValue));
            usedVariables.add(variableAndValue);
        }
    }
870923
private void appendVariableDef(String name, StringBuffer buf) {
        char[] ch = variableNames.get(name);
        if (ch == null) {
            // We allow one undefined variable so that variable definition
            // statements work.  For the first undefined variable we return
            // the special placeholder variableLimit-1, and save the variable
            // name.
            if (undefinedVariableName == null) {
                undefinedVariableName = name;
                if (variableNext >= variableLimit) {
                    throw new RuntimeException("Private use variables exhausted");
                }
                buf.append(--variableLimit);
            } else {
                throw new IllegalIcuArgumentException("Undefined variable $"
                                                   + name);
            }
        } else {
            buf.append(ch);
        }
    }
351325
public String[] getOutputsForFunction(DifferentialFunction function) {
        if (!ops.containsKey(function.getOwnName()))
            throw new ND4JIllegalStateException("Illegal function instance id found " + function.getOwnName());
        List<String> outputs = ops.get(function.getOwnName()).getOutputsOfOp();
        return outputs == null ? null : outputs.toArray(new String[outputs.size()]);
    }
1339898
public void removeDependentVariables(Variable ... depVars) {
		ArrayList<Variable> newDepVars = new ArrayList<Variable>();
		for (Variable v : this.dependentVariables) {
			boolean toRemove = false;
			for (Variable v1 : depVars) {
				if (v.equals(v1)) {
					toRemove = true;
					break;
				}
			}
			if (!toRemove) newDepVars.add(v);
		}
		this.dependentVariables = newDepVars.toArray(new Variable[newDepVars.size()]);
	}
341879
void addVar(TypeVar t) {
        this.undetvars = this.undetvars.prepend(infer.fromTypeVarFun.apply(t));
        this.inferencevars = this.inferencevars.prepend(t);
    }
345277
public void setVariables(List<VariableInitializer> variables) {
        assertNotNull(variables);
        this.variables.clear();
        for (VariableInitializer vi : variables) {
            addVariable(vi);
        }
    }
695969
@Override
	protected void putVariables(Map<String, String> variables) {
		variables.put(ScopeFormat.asVariable(this.key), value);
	}
1020928
def function_parameters(function):
    
    if not callable(function):
        raise TypeError(
            'function_parameters(function=%s) you must pass a function' % (
                function
            )
        )
    def wrapper(*args, **kwargs):
        if function.__doc__ is not None:
            if len(function.__doc__) > 3 and len(
                    args) + len(kwargs) + len(
                        function.__defaults__ if function.__defaults__ else ''
                        ) >= len(getParaList(function)):
                paras_index = [p for p in getParaList(
                    function) if p not in kwargs.keys()]
                for content in [i.split('))')[0
                ] for i in function.__doc__.replace(
                    ' ', '').split('((') if ':' in i and i.split(
                        ':')[0] in paras_index or i.split(':'
                        )[0] in kwargs.keys()]:
                    con = content.split(':')
                    if con[0] in kwargs.keys() or len(args) > paras_index.index(con[0]):
                        # To avoid default parameters
                        try:
                            if not isinstance(eval(con[1]), type):
                                raise TypeError()
                        except Exception:
                            raise TypeError(
                                "function_parameters(%s(%s=%s)) " % (
                                    getsourcefile(function) + 
                                    ' ' + function.__name__,
                                    con[0], con[1]
                                ) + "wrong type given in __doc__" 
                            )
                        received_arg = kwargs.get(con[0])
                        if not received_arg and con[0] in paras_index:
                            # to avoid kwarg when it's arg
                            received_arg = args[paras_index.index(con[0])]
                        if type(received_arg) != eval(con[1]):
                            raise TypeError(
                                "%s(%s=%s) requires type %s" % (
                                    getsourcefile(function) + 
                                    ' ' + function.__name__,
                                    con[0], type(received_arg),
                                    eval(con[1])
                                )
                            )
        return function(*args, **kwargs)
    return wrapper
269633
public void addFunctions(final FunctionSet functions) {
    checkNotNull(functions);
    log.debug("Adding functions: {}", functions);

    Object target = functions.target();
    for (String name : functions.names()) {
      addCommand(null, target, name);
    }
  }