Python4j and python types
Python4j's types by default come with all of the python primitive types supported. These types include: 1. STR: the string type, mapped to java's string type 2. INT: the integer type, mapped to java's long type 3. FLOAT: the float type, mapped to java's double type 4. BOOL: the boolean type, mapped to java's boolean type 5. BYTES: the bytes type, mapped to java's byte array
Our numpy support means seamless interop with the numpy format and using numpy arrays inside and outside of python scripts using the exact same memory references with zero copy. This will allow users to benefit from their numpy expertise, but get reasonable performance using the nd4j framework for the core data structure in java.
In order for python4j to discover which custom types are available. These are loaded using the java service loader interface. This means a user needs to have a META-INF/services folder on the classpath (usually under src/main/resources) in their project with the fully qualified class name: org.nd4j.python4j.PythonType . All types specified should be fully qualified class names like the abstract class org.nd4j.python4j.PythonType.
For sample implementations of PythonType, please see the inline declarations in our PythonTypes top level class and use those as a starting point. You will need to implement an adapt method and specify the appropriate mapping of python type to java type.