本文整理汇总了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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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