当前位置: 首页>>代码示例>>Python>>正文


Python numpy.loads方法代码示例

本文整理汇总了Python中numpy.loads方法的典型用法代码示例。如果您正苦于以下问题:Python numpy.loads方法的具体用法?Python numpy.loads怎么用?Python numpy.loads使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在numpy的用法示例。


在下文中一共展示了numpy.loads方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: read_qa_comat

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import loads [as 别名]
def read_qa_comat(filename):
    qa_comat_dict = {}
    print 'read qa_comat ...'
    with open(filename) as fin:
        for l in tqdm(fin):
            to = l.strip().split('\t')
            #print 'test len(to): ', len(to)
            m = np.loads(base64.b32decode(to[1]))
            # print 'test m: ', m
            # to[0] key which is qid_uid_rid; to[1] is the corresponding
            # 3-row numpy array to denote the qa co-occur matrix
            m0 = np.asarray(m[0], dtype=np.int16)
            m1 = np.asarray(m[1], dtype=np.int16)
            qa_comat_dict[to[0]] = [m0,m1,m[2]]
    return qa_comat_dict

# Convert Embedding Dict 2 numpy array 
开发者ID:yangliuy,项目名称:NeuralResponseRanking,代码行数:19,代码来源:rank_io.py

示例2: loads

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import loads [as 别名]
def loads(*args, **kwargs):
    # NumPy 1.15.0, 2017-12-10
    warnings.warn(
        "np.loads is deprecated, use pickle.loads instead",
        DeprecationWarning, stacklevel=2)
    return pickle.loads(*args, **kwargs) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:8,代码来源:npyio.py

示例3: deserialise_nparr

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import loads [as 别名]
def deserialise_nparr(arr_str):
    arr = np.loads(base64.b64decode(arr_str))
    return np.array(arr, dtype=np.float32) 
开发者ID:openai,项目名称:glow,代码行数:5,代码来源:server.py

示例4: from_rpc_dict

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import loads [as 别名]
def from_rpc_dict(cls, d):
        if d is None:
            return None
        data = numpy.loads(base64.b64decode(d["data"].encode('utf-8')))
        data_shape_and_dtype = data.shape, data.dtype  # TODO: DataAndMetadata from_rpc_dict fails for RGB
        intensity_calibration = Calibration.from_rpc_dict(d.get("intensity_calibration"))
        if "dimensional_calibrations" in d:
            dimensional_calibrations = [Calibration.from_rpc_dict(dc) for dc in d.get("dimensional_calibrations")]
        else:
            dimensional_calibrations = None
        metadata = d.get("metadata", {})
        timestamp = datetime.datetime(*map(int, re.split('[^\d]', d.get("timestamp")))) if "timestamp" in d else None
        return DataAndCalibration(lambda: data, data_shape_and_dtype, intensity_calibration, dimensional_calibrations, metadata, timestamp) 
开发者ID:nion-software,项目名称:nionswift,代码行数:15,代码来源:Structs.py


注:本文中的numpy.loads方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。