nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java
public void addOutgoingFor(String[] varNames, DifferentialFunction function) {

        if (function.getOwnName() == null)
            throw new ND4JIllegalStateException("Instance id can not be null. Function not initialized properly");

        if (outgoingArgsReverse.containsKey(function.getOwnName())) {
            throw new ND4JIllegalStateException("Outgoing arguments already declared for " + function);
        }

        if (varNames == null)
            throw new ND4JIllegalStateException("Var names can not be null!");


        for (int i = 0; i < varNames.length; i++) {
            if (varNames[i] == null)
                throw new ND4JIllegalStateException("Variable name elements can not be null!");
        }

        outgoingArgsReverse.put(function.getOwnName(), varNames);
        outgoingArgs.put(varNames, function);

        for (val resultName : varNames) {
            List<DifferentialFunction> funcs = functionOutputFor.get(resultName);
            if (funcs == null) {
                funcs = new ArrayList<>();
                functionOutputFor.put(resultName, funcs);
            }

            funcs.add(function);
        }

    }
public void addOutgoingFor(String[] varNames, DifferentialFunction function) {

        if (function.getOwnName() == null)
            throw new ND4JIllegalStateException("Instance id can not be null. Function not initialized properly");

        if (outgoingArgsReverse.containsKey(function.getOwnName())) {
            throw new ND4JIllegalStateException("Outgoing arguments already declared for " + function);
        }

        if (varNames == null)
            throw new ND4JIllegalStateException("Var names can not be null!");


        for (int i = 0; i < varNames.length; i++) {
            if (varNames[i] == null)
                throw new ND4JIllegalStateException("Variable name elements can not be null!");
        }

        outgoingArgsReverse.put(function.getOwnName(), varNames);
        outgoingArgs.put(varNames, function);

        for (val resultName : varNames) {
            List<DifferentialFunction> funcs = functionOutputFor.get(resultName);
            if (funcs == null) {
                funcs = new ArrayList<>();
                functionOutputFor.put(resultName, funcs);
            }

            funcs.add(function);
        }

    }
public void addOutgoingFor ( String [ ] varNames , DifferentialFunction function ) { if ( function . getOwnName ( ) == null ) throw new ND4JIllegalStateException ( "Instance id can not be null. Function not initialized properly" ) ; if ( outgoingArgsReverse . containsKey ( function . getOwnName ( ) ) ) { throw new ND4JIllegalStateException ( "Outgoing arguments already declared for " + function ) ; } if ( varNames == null ) throw new ND4JIllegalStateException ( "Var names can not be null!" ) ; for ( int i = 0 ; i < varNames . length ; i ++ ) { if ( varNames [ i ] == null ) throw new ND4JIllegalStateException ( "Variable name elements can not be null!" ) ; } outgoingArgsReverse . put ( function . getOwnName ( ) , varNames ) ; outgoingArgs . put ( varNames , function ) ; for ( val resultName : varNames ) { List < DifferentialFunction > funcs = functionOutputFor . get ( resultName ) ; if ( funcs == null ) { funcs = new ArrayList <> ( ) ; functionOutputFor . put ( resultName , funcs ) ; } funcs . add ( function ) ; } }
Adds outgoing arguments to the graph.
Also checks for input arguments
and updates the graph adding an appropriate edge
when the full graph is declared.

@param varNames
@param function
Adds outgoing arguments to the graph . Also checks for input arguments and updates the graph adding an appropriate edge when the full graph is declared .