pyxis.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:ml-pyxis 作者: vicolab 项目源码 文件源码
def decode_data(obj):
    """Decode a serialised data object.

    Parameter
    ---------
    obj : Python dictionary
        A dictionary describing a serialised data object.
    """
    try:
        if TYPES['str'] == obj[b'type']:
            return decode_str(obj[b'data'])
        elif TYPES['ndarray'] == obj[b'type']:
            return np.fromstring(obj[b'data'], dtype=np.dtype(
                obj[b'dtype'])).reshape(obj[b'shape'])
        else:
            # Assume the user know what they are doing
            return obj
    except KeyError:
        # Assume the user know what they are doing
        return obj
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号