當前位置: 首頁>>代碼示例>>Python>>正文


Python cloudpickle.loads方法代碼示例

本文整理匯總了Python中cloudpickle.loads方法的典型用法代碼示例。如果您正苦於以下問題:Python cloudpickle.loads方法的具體用法?Python cloudpickle.loads怎麽用?Python cloudpickle.loads使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cloudpickle的用法示例。


在下文中一共展示了cloudpickle.loads方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: execute

# 需要導入模塊: import cloudpickle [as 別名]
# 或者: from cloudpickle import loads [as 別名]
def execute(cls, ctx, op):
        if op.gpu:  # pragma: no cover
            raise NotImplementedError('Does not support tree-based '
                                      'nearest neighbors on GPU')

        x = ctx[op.input.key]
        if len(op.inputs) == 2:
            tree = ctx[op.tree.key]
        else:
            tree = op.tree
        tree = cloudpickle.loads(tree) if isinstance(tree, bytes) else tree
        ret = tree.query(x, op.n_neighbors, op.return_distance)
        if op.return_distance:
            ctx[op.outputs[0].key] = ret[0]
            ctx[op.outputs[1].key] = ret[1]
        else:
            ctx[op.outputs[0].key] = ret 
開發者ID:mars-project,項目名稱:mars,代碼行數:19,代碼來源:tree.py

示例2: _set_mesh

# 需要導入模塊: import cloudpickle [as 別名]
# 或者: from cloudpickle import loads [as 別名]
def _set_mesh(self, value):
        """setter of mesh"""
        try:  # Check the type
            check_var("mesh", value, "dict")
        except CheckTypeError:
            check_var("mesh", value, "pyvista.core.pointset.UnstructuredGrid")
            # property can be set from a list to handle loads
        if (
            type(value) == dict
        ):  # Load type from saved dict {"type":type(value),"str": str(value),"serialized": serialized(value)]
            self._mesh = loads(value["serialized"].encode("ISO-8859-2"))
        else:
            self._mesh = value

    # Pyvista object of the mesh (optional)
    # Type : pyvista.core.pointset.UnstructuredGrid 
開發者ID:Eomys,項目名稱:pyleecan,代碼行數:18,代碼來源:MeshVTK.py

示例3: _set_surf

# 需要導入模塊: import cloudpickle [as 別名]
# 或者: from cloudpickle import loads [as 別名]
def _set_surf(self, value):
        """setter of surf"""
        try:  # Check the type
            check_var("surf", value, "dict")
        except CheckTypeError:
            check_var("surf", value, "pyvista.core.pointset.PolyData")
            # property can be set from a list to handle loads
        if (
            type(value) == dict
        ):  # Load type from saved dict {"type":type(value),"str": str(value),"serialized": serialized(value)]
            self._surf = loads(value["serialized"].encode("ISO-8859-2"))
        else:
            self._surf = value

    # Pyvista object of the outer surface
    # Type : pyvista.core.pointset.PolyData 
開發者ID:Eomys,項目名稱:pyleecan,代碼行數:18,代碼來源:MeshVTK.py

示例4: _set_function

# 需要導入模塊: import cloudpickle [as 別名]
# 或者: from cloudpickle import loads [as 別名]
def _set_function(self, value):
        """setter of function"""
        try:
            check_var("function", value, "list")
        except CheckTypeError:
            check_var("function", value, "function")
        if isinstance(value, list):  # Load function from saved dict
            self._function = [loads(value[0].encode("ISO-8859-2")), value[1]]
        elif value is None:
            self._function = [None, None]
        elif callable(value):
            self._function = [value, getsource(value)]
        else:
            raise TypeError(
                "Expected function or list from a saved file, got: " + str(type(value))
            )

    # Function of the space to initiate the variable
    # Type : function 
開發者ID:Eomys,項目名稱:pyleecan,代碼行數:21,代碼來源:OptiDesignVar.py

示例5: _set_Br

# 需要導入模塊: import cloudpickle [as 別名]
# 或者: from cloudpickle import loads [as 別名]
def _set_Br(self, value):
        """setter of Br"""
        try:  # Check the type
            check_var("Br", value, "dict")
        except CheckTypeError:
            check_var("Br", value, "SciDataTool.Classes.DataND.DataND")
            # property can be set from a list to handle loads
        if (
            type(value) == dict
        ):  # Load type from saved dict {"type":type(value),"str": str(value),"serialized": serialized(value)]
            self._Br = loads(value["serialized"].encode("ISO-8859-2"))
        else:
            self._Br = value

    # Radial airgap flux density
    # Type : SciDataTool.Classes.DataND.DataND 
開發者ID:Eomys,項目名稱:pyleecan,代碼行數:18,代碼來源:OutMag.py

示例6: _set_Bt

# 需要導入模塊: import cloudpickle [as 別名]
# 或者: from cloudpickle import loads [as 別名]
def _set_Bt(self, value):
        """setter of Bt"""
        try:  # Check the type
            check_var("Bt", value, "dict")
        except CheckTypeError:
            check_var("Bt", value, "SciDataTool.Classes.DataND.DataND")
            # property can be set from a list to handle loads
        if (
            type(value) == dict
        ):  # Load type from saved dict {"type":type(value),"str": str(value),"serialized": serialized(value)]
            self._Bt = loads(value["serialized"].encode("ISO-8859-2"))
        else:
            self._Bt = value

    # Tangential airgap flux density
    # Type : SciDataTool.Classes.DataND.DataND 
開發者ID:Eomys,項目名稱:pyleecan,代碼行數:18,代碼來源:OutMag.py

示例7: _set_selector

# 需要導入模塊: import cloudpickle [as 別名]
# 或者: from cloudpickle import loads [as 別名]
def _set_selector(self, value):
        """setter of selector"""
        try:
            check_var("selector", value, "list")
        except CheckTypeError:
            check_var("selector", value, "function")
        if isinstance(value, list):  # Load function from saved dict
            self._selector = [loads(value[0].encode("ISO-8859-2")), value[1]]
        elif value is None:
            self._selector = [None, None]
        elif callable(value):
            self._selector = [value, getsource(value)]
        else:
            raise TypeError(
                "Expected function or list from a saved file, got: " + str(type(value))
            )

    # Selector of the genetic algorithm
    # Type : function 
開發者ID:Eomys,項目名稱:pyleecan,代碼行數:21,代碼來源:OptiGenAlg.py

示例8: _set_crossover

# 需要導入模塊: import cloudpickle [as 別名]
# 或者: from cloudpickle import loads [as 別名]
def _set_crossover(self, value):
        """setter of crossover"""
        try:
            check_var("crossover", value, "list")
        except CheckTypeError:
            check_var("crossover", value, "function")
        if isinstance(value, list):  # Load function from saved dict
            self._crossover = [loads(value[0].encode("ISO-8859-2")), value[1]]
        elif value is None:
            self._crossover = [None, None]
        elif callable(value):
            self._crossover = [value, getsource(value)]
        else:
            raise TypeError(
                "Expected function or list from a saved file, got: " + str(type(value))
            )

    # Crossover of the genetic algorithm
    # Type : function 
開發者ID:Eomys,項目名稱:pyleecan,代碼行數:21,代碼來源:OptiGenAlg.py

示例9: _set_mutator

# 需要導入模塊: import cloudpickle [as 別名]
# 或者: from cloudpickle import loads [as 別名]
def _set_mutator(self, value):
        """setter of mutator"""
        try:
            check_var("mutator", value, "list")
        except CheckTypeError:
            check_var("mutator", value, "function")
        if isinstance(value, list):  # Load function from saved dict
            self._mutator = [loads(value[0].encode("ISO-8859-2")), value[1]]
        elif value is None:
            self._mutator = [None, None]
        elif callable(value):
            self._mutator = [value, getsource(value)]
        else:
            raise TypeError(
                "Expected function or list from a saved file, got: " + str(type(value))
            )

    # Mutator of the genetic algorithm
    # Type : function 
開發者ID:Eomys,項目名稱:pyleecan,代碼行數:21,代碼來源:OptiGenAlg.py

示例10: _set_toolbox

# 需要導入模塊: import cloudpickle [as 別名]
# 或者: from cloudpickle import loads [as 別名]
def _set_toolbox(self, value):
        """setter of toolbox"""
        try:  # Check the type
            check_var("toolbox", value, "dict")
        except CheckTypeError:
            check_var("toolbox", value, "deap.base.Toolbox")
            # property can be set from a list to handle loads
        if (
            type(value) == dict
        ):  # Load type from saved dict {"type":type(value),"str": str(value),"serialized": serialized(value)]
            self._toolbox = loads(value["serialized"].encode("ISO-8859-2"))
        else:
            self._toolbox = value

    # DEAP toolbox
    # Type : deap.base.Toolbox 
開發者ID:Eomys,項目名稱:pyleecan,代碼行數:18,代碼來源:OptiGenAlgNsga2Deap.py

示例11: _set_mmf_unit

# 需要導入模塊: import cloudpickle [as 別名]
# 或者: from cloudpickle import loads [as 別名]
def _set_mmf_unit(self, value):
        """setter of mmf_unit"""
        try:  # Check the type
            check_var("mmf_unit", value, "dict")
        except CheckTypeError:
            check_var("mmf_unit", value, "SciDataTool.Classes.DataND.DataND")
            # property can be set from a list to handle loads
        if (
            type(value) == dict
        ):  # Load type from saved dict {"type":type(value),"str": str(value),"serialized": serialized(value)]
            self._mmf_unit = loads(value["serialized"].encode("ISO-8859-2"))
        else:
            self._mmf_unit = value

    # Unit magnetomotive force
    # Type : SciDataTool.Classes.DataND.DataND 
開發者ID:Eomys,項目名稱:pyleecan,代碼行數:18,代碼來源:OutElec.py

示例12: _set_eval_func

# 需要導入模塊: import cloudpickle [as 別名]
# 或者: from cloudpickle import loads [as 別名]
def _set_eval_func(self, value):
        """setter of eval_func"""
        try:
            check_var("eval_func", value, "list")
        except CheckTypeError:
            check_var("eval_func", value, "function")
        if isinstance(value, list):  # Load function from saved dict
            self._eval_func = [loads(value[0].encode("ISO-8859-2")), value[1]]
        elif value is None:
            self._eval_func = [None, None]
        elif callable(value):
            self._eval_func = [value, getsource(value)]
        else:
            raise TypeError(
                "Expected function or list from a saved file, got: " + str(type(value))
            )

    # Function to evaluate before computing obj function and constraints
    # Type : function 
開發者ID:Eomys,項目名稱:pyleecan,代碼行數:21,代碼來源:OptiProblem.py

示例13: _set_Yr

# 需要導入模塊: import cloudpickle [as 別名]
# 或者: from cloudpickle import loads [as 別名]
def _set_Yr(self, value):
        """setter of Yr"""
        try:  # Check the type
            check_var("Yr", value, "dict")
        except CheckTypeError:
            check_var("Yr", value, "SciDataTool.Classes.DataND.DataND")
            # property can be set from a list to handle loads
        if (
            type(value) == dict
        ):  # Load type from saved dict {"type":type(value),"str": str(value),"serialized": serialized(value)]
            self._Yr = loads(value["serialized"].encode("ISO-8859-2"))
        else:
            self._Yr = value

    # Displacement output
    # Type : SciDataTool.Classes.DataND.DataND 
開發者ID:Eomys,項目名稱:pyleecan,代碼行數:18,代碼來源:OutStruct.py

示例14: _set_Vr

# 需要導入模塊: import cloudpickle [as 別名]
# 或者: from cloudpickle import loads [as 別名]
def _set_Vr(self, value):
        """setter of Vr"""
        try:  # Check the type
            check_var("Vr", value, "dict")
        except CheckTypeError:
            check_var("Vr", value, "SciDataTool.Classes.DataND.DataND")
            # property can be set from a list to handle loads
        if (
            type(value) == dict
        ):  # Load type from saved dict {"type":type(value),"str": str(value),"serialized": serialized(value)]
            self._Vr = loads(value["serialized"].encode("ISO-8859-2"))
        else:
            self._Vr = value

    # Velocity output
    # Type : SciDataTool.Classes.DataND.DataND 
開發者ID:Eomys,項目名稱:pyleecan,代碼行數:18,代碼來源:OutStruct.py

示例15: _set_Ar

# 需要導入模塊: import cloudpickle [as 別名]
# 或者: from cloudpickle import loads [as 別名]
def _set_Ar(self, value):
        """setter of Ar"""
        try:  # Check the type
            check_var("Ar", value, "dict")
        except CheckTypeError:
            check_var("Ar", value, "SciDataTool.Classes.DataND.DataND")
            # property can be set from a list to handle loads
        if (
            type(value) == dict
        ):  # Load type from saved dict {"type":type(value),"str": str(value),"serialized": serialized(value)]
            self._Ar = loads(value["serialized"].encode("ISO-8859-2"))
        else:
            self._Ar = value

    # Acceleration output
    # Type : SciDataTool.Classes.DataND.DataND 
開發者ID:Eomys,項目名稱:pyleecan,代碼行數:18,代碼來源:OutStruct.py


注:本文中的cloudpickle.loads方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。