Skip to content

Comparison vs DL4J / java-cpp #18

@Robbie-Palmer

Description

@Robbie-Palmer

FLIP-206 compares PemJa to Jython, GraalVM, JPype and Jep

deeplearning4j's Python4J framework seems more comparable to PemJa than any of these
It depends on javacpp-presets which bundles CPython into a Jar and depends on java-cpp to abstract from the JNI

API example:

try(PythonGIL gil = PythonGIL.lock()){
        try(PythonGC gc = PythonGC.watch()){
            List<PythonVariable> inputs = new ArrayList<>();
            inputs.add(new PythonVariable<>("x", PythonTypes.STR, "Hello "));
            inputs.add(new PythonVariable<>("y", PythonTypes.STR, "World"));
            PythonVariable out = new PythonVariable<>("z", PythonTypes.STR);
            String code = "z = x + y";
            PythonExecutioner.exec(code, inputs, Collections.singletonList(out));
            System.out.println(out.getValue());
        }
    }catch (Throwable e){
        e.printStackTrace();
    }

A comparison between this approach and that of PemJa would be very useful

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions