nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java
public String asFlatPrint() {
        val sb = new StringBuilder();
        val fb = asFlatBuffers();

        val graph = FlatGraph.getRootAsFlatGraph(fb);

        sb.append("\nExternal variables:\n\n");
        for (int e = 0; e < graph.variablesLength(); e++) {
            val var = graph.variables(e);
            val ndarray = Nd4j.createFromFlatArray(var.ndarray());

            sb.append(var.id().first())
                    .append(":<").append(var.name()).append("> ")
                    .append(Arrays.toString(ndarray.shapeInfoDataBuffer().asInt())).append("; Values: ").append(Arrays.toString(ndarray.data().asFloat())).append(";\n");
        }

        val map = Nd4j.getExecutioner().getCustomOperations();


        sb.append("\nOps sequence:\n\n");
        for (int e = 0; e < graph.nodesLength(); e++) {
            val node = graph.nodes(e);

            log.info("{}:<{}>", node.id(), node.name());
            sb.append(node.id())
                    .append(":<").append(node.name()).append("> ").append(SameDiff.getTypeFromByte(node.opType()));

            if (SameDiff.getTypeFromByte(node.opType()) != Op.Type.CUSTOM)
                sb.append(": ").append(node.opNum());
            else {
                val keys = map.keySet();
                String opName = null;
                for (val k : keys) {
                    val d = map.get(k);
                    if (d.getHash() == node.opNum())
                        opName = k;
                }

                if (opName == null)
                    opName = "unknown";

                sb.append(": ").append(opName);
            }

            sb.append("; Inputs: {");

            for (int i = 0; i < node.inputPairedLength(); i++) {
                val pair = node.inputPaired(i);

                sb.append("[").append(pair.first()).append(":").append(pair.second()).append("]");

                if (i < node.inputPairedLength() - 1)
                    sb.append(", ");
            }

            sb.append("};");
            sb.append(" OpNum: {").append(node.opNum()).append("};");

            sb.append("\n");
        }


        return sb.toString();
    }
public String asFlatPrint() {
        val sb = new StringBuilder();
        val fb = asFlatBuffers();

        val graph = FlatGraph.getRootAsFlatGraph(fb);

        sb.append("\nExternal variables:\n\n");
        for (int e = 0; e < graph.variablesLength(); e++) {
            val var = graph.variables(e);
            val ndarray = Nd4j.createFromFlatArray(var.ndarray());

            sb.append(var.id().first())
                    .append(":<").append(var.name()).append("> ")
                    .append(Arrays.toString(ndarray.shapeInfoDataBuffer().asInt())).append("; Values: ").append(Arrays.toString(ndarray.data().asFloat())).append(";\n");
        }

        val map = Nd4j.getExecutioner().getCustomOperations();


        sb.append("\nOps sequence:\n\n");
        for (int e = 0; e < graph.nodesLength(); e++) {
            val node = graph.nodes(e);

            log.info("{}:<{}>", node.id(), node.name());
            sb.append(node.id())
                    .append(":<").append(node.name()).append("> ").append(SameDiff.getTypeFromByte(node.opType()));

            if (SameDiff.getTypeFromByte(node.opType()) != Op.Type.CUSTOM)
                sb.append(": ").append(node.opNum());
            else {
                val keys = map.keySet();
                String opName = null;
                for (val k : keys) {
                    val d = map.get(k);
                    if (d.getHash() == node.opNum())
                        opName = k;
                }

                if (opName == null)
                    opName = "unknown";

                sb.append(": ").append(opName);
            }

            sb.append("; Inputs: {");

            for (int i = 0; i < node.inputPairedLength(); i++) {
                val pair = node.inputPaired(i);

                sb.append("[").append(pair.first()).append(":").append(pair.second()).append("]");

                if (i < node.inputPairedLength() - 1)
                    sb.append(", ");
            }

            sb.append("};");
            sb.append(" OpNum: {").append(node.opNum()).append("};");

            sb.append("\n");
        }


        return sb.toString();
    }
public String asFlatPrint ( ) { val sb = new StringBuilder ( ) ; val fb = asFlatBuffers ( ) ; val graph = FlatGraph . getRootAsFlatGraph ( fb ) ; sb . append ( "\nExternal variables:\n\n" ) ; for ( int e = 0 ; e < graph . variablesLength ( ) ; e ++ ) { val var = graph . variables ( e ) ; val ndarray = Nd4j . createFromFlatArray ( var . ndarray ( ) ) ; sb . append ( var . id ( ) . first ( ) ) . append ( ":<" ) . append ( var . name ( ) ) . append ( "> " ) . append ( Arrays . toString ( ndarray . shapeInfoDataBuffer ( ) . asInt ( ) ) ) . append ( "; Values: " ) . append ( Arrays . toString ( ndarray . data ( ) . asFloat ( ) ) ) . append ( ";\n" ) ; } val map = Nd4j . getExecutioner ( ) . getCustomOperations ( ) ; sb . append ( "\nOps sequence:\n\n" ) ; for ( int e = 0 ; e < graph . nodesLength ( ) ; e ++ ) { val node = graph . nodes ( e ) ; log . info ( "{}:<{}>" , node . id ( ) , node . name ( ) ) ; sb . append ( node . id ( ) ) . append ( ":<" ) . append ( node . name ( ) ) . append ( "> " ) . append ( SameDiff . getTypeFromByte ( node . opType ( ) ) ) ; if ( SameDiff . getTypeFromByte ( node . opType ( ) ) != Op . Type . CUSTOM ) sb . append ( ": " ) . append ( node . opNum ( ) ) ; else { val keys = map . keySet ( ) ; String opName = null ; for ( val k : keys ) { val d = map . get ( k ) ; if ( d . getHash ( ) == node . opNum ( ) ) opName = k ; } if ( opName == null ) opName = "unknown" ; sb . append ( ": " ) . append ( opName ) ; } sb . append ( "; Inputs: {" ) ; for ( int i = 0 ; i < node . inputPairedLength ( ) ; i ++ ) { val pair = node . inputPaired ( i ) ; sb . append ( "[" ) . append ( pair . first ( ) ) . append ( ":" ) . append ( pair . second ( ) ) . append ( "]" ) ; if ( i < node . inputPairedLength ( ) - 1 ) sb . append ( ", " ) ; } sb . append ( "};" ) ; sb . append ( " OpNum: {" ) . append ( node . opNum ( ) ) . append ( "};" ) ; sb . append ( "\n" ) ; } return sb . toString ( ) ; }
This method returns "flattened" graph.

@return
This method returns flattened graph .