def of(jvalue, bigdl_type="float"):
        """
        Create a Python Layer base on the given java value and the real type.
        :param jvalue: Java object create by Py4j
        :return: A Python Layer
        """
        def get_py_name(jclass_name):
            if jclass_name == "StaticGraph" or jclass_name == "DynamicGraph":
                return "Model"
            elif jclass_name == "Input":
                return "Layer"
            else:
                return jclass_name

        jname = callBigDlFunc(bigdl_type,
                                      "getRealClassNameOfJValue",
                                      jvalue)

        jpackage_name = ".".join(jname.split(".")[:-1])
        pclass_name = get_py_name(jname.split(".")[-1])

        if "com.intel.analytics.bigdl.nn.keras.Model" == jname or \
                        "com.intel.analytics.bigdl.nn.keras.Sequential" == jname:
            base_module = importlib.import_module('bigdl.nn.keras.topology')
        elif "com.intel.analytics.bigdl.nn.keras" == jpackage_name:
            base_module = importlib.import_module('bigdl.nn.keras.layer')
        else:
            base_module = importlib.import_module('bigdl.nn.layer')

        realClassName = "Layer" # The top base class
        if pclass_name in dir(base_module):
            realClassName = pclass_name
        module = getattr(base_module, realClassName)
        jvalue_creator = getattr(module, "from_jvalue")
        model = jvalue_creator(jvalue, bigdl_type)
        return model
def of(jvalue, bigdl_type="float"):
        """
        Create a Python Layer base on the given java value and the real type.
        :param jvalue: Java object create by Py4j
        :return: A Python Layer
        """
        def get_py_name(jclass_name):
            if jclass_name == "StaticGraph" or jclass_name == "DynamicGraph":
                return "Model"
            elif jclass_name == "Input":
                return "Layer"
            else:
                return jclass_name

        jname = callBigDlFunc(bigdl_type,
                                      "getRealClassNameOfJValue",
                                      jvalue)

        jpackage_name = ".".join(jname.split(".")[:-1])
        pclass_name = get_py_name(jname.split(".")[-1])

        if "com.intel.analytics.bigdl.nn.keras.Model" == jname or \
                        "com.intel.analytics.bigdl.nn.keras.Sequential" == jname:
            base_module = importlib.import_module('bigdl.nn.keras.topology')
        elif "com.intel.analytics.bigdl.nn.keras" == jpackage_name:
            base_module = importlib.import_module('bigdl.nn.keras.layer')
        else:
            base_module = importlib.import_module('bigdl.nn.layer')

        realClassName = "Layer" # The top base class
        if pclass_name in dir(base_module):
            realClassName = pclass_name
        module = getattr(base_module, realClassName)
        jvalue_creator = getattr(module, "from_jvalue")
        model = jvalue_creator(jvalue, bigdl_type)
        return model
def of ( jvalue , bigdl_type = "float" ) : def get_py_name ( jclass_name ) : if jclass_name == "StaticGraph" or jclass_name == "DynamicGraph" : return "Model" elif jclass_name == "Input" : return "Layer" else : return jclass_name jname = callBigDlFunc ( bigdl_type , "getRealClassNameOfJValue" , jvalue ) jpackage_name = "." . join ( jname . split ( "." ) [ : - 1 ] ) pclass_name = get_py_name ( jname . split ( "." ) [ - 1 ] ) if "com.intel.analytics.bigdl.nn.keras.Model" == jname or "com.intel.analytics.bigdl.nn.keras.Sequential" == jname : base_module = importlib . import_module ( 'bigdl.nn.keras.topology' ) elif "com.intel.analytics.bigdl.nn.keras" == jpackage_name : base_module = importlib . import_module ( 'bigdl.nn.keras.layer' ) else : base_module = importlib . import_module ( 'bigdl.nn.layer' ) realClassName = "Layer" # The top base class if pclass_name in dir ( base_module ) : realClassName = pclass_name module = getattr ( base_module , realClassName ) jvalue_creator = getattr ( module , "from_jvalue" ) model = jvalue_creator ( jvalue , bigdl_type ) return model
Create a Python Layer base on the given java value and the real type.
        :param jvalue: Java object create by Py4j
        :return: A Python Layer
Create a Python Layer base on the given java value and the real type . : param jvalue : Java object create by Py4j : return : A Python Layer