當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。