dtype: NotImplementedError: float16

未关闭
#263 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
numpy, python
领域
data

调研方向

从 sparse/coo/common.py 中的 _dot_coo_coo_type 开始,使用 np.float16 或 np.int8 重现报告中的 sparse.COO 和 sparse.dot 操作序列。检查 dtype 如何传递到 Numba helper;当报告中的 dot 操作对于所请求的 dtype 不再引发 NotImplementedError 时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

upstream

Hello, I am trying to reduce the memory footprint of the matrices containing small integers, and want to set the dtype to np.int8 or np.float16.

import sparse
import numpy as np
x=sparse.COO(np.random.rand(5*10**2, 5*10**2)).astype(np.float16)
y = sparse.dot(x,x)
z = sparse.dot(y,y)

This is the error I get:

myenvpath/lib/python3.6/site-packages/sparse/coo/common.py in _dot_coo_coo_type(dt1, dt2)
   1208 
   1209     @numba.jit(nopython=True, nogil=True,
-> 1210                locals={'data_curr': numba.numpy_support.from_dtype(dtr)})
   1211     def _dot_coo_coo(coords1, data1, coords2, data2):  # pragma: no cover
   1212         """

myenvpath/lib/python3.6/site-packages/numba/numpy_support.py in from_dtype(dtype)
    106             return types.NestedArray(subtype, dtype.shape)
    107 
--> 108     raise NotImplementedError(dtype)
    109 
    110 

NotImplementedError: float16
主要语言
Python
星标
670
派生
167
平均合并
3 天 4 小时
30 天内合并 PR
7

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

pydata/sparse 的其他 Issue

查看 pydata/sparse 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。