Python numpy.loads() Examples

The following are 14 code examples for showing how to use numpy.loads(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module numpy , or try the search function .

Example 1
Project: NeuralResponseRanking   Author: yangliuy   File: rank_io.py    License: MIT License 6 votes vote down vote up
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 
Example 2
Project: recruit   Author: Frank-qlu   File: npyio.py    License: Apache License 2.0 5 votes vote down vote up
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) 
Example 3
Project: lambda-packs   Author: ryfeus   File: npyio.py    License: MIT License 5 votes vote down vote up
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) 
Example 4
Project: glow   Author: openai   File: server.py    License: MIT License 5 votes vote down vote up
def deserialise_nparr(arr_str):
    arr = np.loads(base64.b64decode(arr_str))
    return np.array(arr, dtype=np.float32) 
Example 5
Project: Mastering-Elasticsearch-7.0   Author: PacktPublishing   File: npyio.py    License: MIT License 5 votes vote down vote up
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) 
Example 6
Project: GraphicDesignPatternByPython   Author: Relph1119   File: npyio.py    License: MIT License 5 votes vote down vote up
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) 
Example 7
Project: predictive-maintenance-using-machine-learning   Author: awslabs   File: npyio.py    License: Apache License 2.0 5 votes vote down vote up
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) 
Example 8
Project: pySINDy   Author: luckystarufo   File: npyio.py    License: MIT License 5 votes vote down vote up
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) 
Example 9
Project: nionswift   Author: nion-software   File: Structs.py    License: GNU General Public License v3.0 5 votes vote down vote up
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) 
Example 10
Project: pix2pix-flow   Author: yenchenlin   File: server.py    License: MIT License 5 votes vote down vote up
def deserialise_nparr(arr_str):
    arr = np.loads(base64.b64decode(arr_str))
    return np.array(arr, dtype=np.float32) 
Example 11
Project: coffeegrindsize   Author: jgagneastro   File: npyio.py    License: MIT License 5 votes vote down vote up
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) 
Example 12
Project: Carnets   Author: holzschu   File: npyio.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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) 
Example 13
Project: Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda   Author: PacktPublishing   File: npyio.py    License: MIT License 5 votes vote down vote up
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) 
Example 14
Project: twitter-stock-recommendation   Author: alvarobartt   File: npyio.py    License: MIT License 5 votes vote down vote up
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)