util.py 文件源码

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

项目:compresso 作者: VCG 项目源码 文件源码
def get_size(variable):
        '''Get bytes of variable
        '''
        if type(variable).__module__ == np.__name__:
            variable = variable.tobytes()
        elif type(variable) is str:
            assert (all(ord(c) < 256) for c in variable)
        else:
            raise ValueError('Data type not supported')

        # checking the length of a bytestring is more accurate
        return len(variable)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号