dtype.py 文件源码

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

项目:bifrost 作者: ledatelescope 项目源码 文件源码
def numpy2string(dtype):
    if   dtype == np.int8:       return 'i8'
    elif dtype == np.int16:      return 'i16'
    elif dtype == np.int32:      return 'i32'
    elif dtype == np.int64:      return 'i64'
    elif dtype == np.uint8:      return 'u8'
    elif dtype == np.uint16:     return 'u16'
    elif dtype == np.uint32:     return 'u32'
    elif dtype == np.uint64:     return 'u64'
    elif dtype == np.float16:    return 'f16'
    elif dtype == np.float32:    return 'f32'
    elif dtype == np.float64:    return 'f64'
    elif dtype == np.float128:   return 'f128'
    elif dtype == np.complex64:  return 'cf32'
    elif dtype == np.complex128: return 'cf64'
    elif dtype == np.complex256: return 'cf128'
    else: raise TypeError("Unsupported dtype: " + str(dtype))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号