Skip to content

paddle 不支持uint32, 但是在文档里表明了支持 #65350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wangguan1995 opened this issue Jun 21, 2024 · 7 comments
Open

paddle 不支持uint32, 但是在文档里表明了支持 #65350

wangguan1995 opened this issue Jun 21, 2024 · 7 comments
Assignees

Comments

@wangguan1995
Copy link

bug描述 Describe the Bug

image

import paddle
import numpy as np

# 创建一个uint32的numpy array
data = np.array([1, 2, 3], dtype='uint32')

# 转换为Paddle Tensor
tensor = paddle.to_tensor(data)
# 2147483647
# 2267117488
print(tensor)

其他补充信息 Additional Supplementary Information

No response

@YanhuiDua
Copy link
Contributor

你好,这个问题我看下,有结论或者修复的PR会更新在这里

@YanhuiDua
Copy link
Contributor

YanhuiDua commented Jun 25, 2024

你好,Paddle支持的数据类型可以参考这个文档:https://www.paddlepaddle.org.cn/documentation/docs/zh/guides/beginner/tensor_cn.html#tensor-dtype

你图里的文档是自定义C++算子的文档,具体是指当自定义C++算子时,输入的tensor支持下面的类型,其中包括uint32;

但是你给的测试代码为python代码,这里支持的数据类型与自定义C++算子无关,Paddle暂时暂未支持uint32类型的数据从numpy转换为paddle.tensor

@wangguan1995
Copy link
Author

你好,Paddle支持的数据类型可以参考这个文档:https://www.paddlepaddle.org.cn/documentation/docs/zh/guides/beginner/tensor_cn.html#tensor-dtype

你图里的文档是自定义C++算子的文档,具体是指当自定义C++算子时,输入的tensor支持下面的类型,其中包括uint32;

但是你给的测试代码为python代码,这里支持的数据类型与自定义C++算子无关,Paddle暂时暂未支持uint32类型的数据从numpy转换为paddle.tensor

那自定义算子里做好的unint32 Tensor怎么导出到python 的paddle Tensor?

@YanhuiDua
Copy link
Contributor

请问是什么情况下 uint32 tensor 要导出到python的paddle Tensor呢? 你的需求是啥呢

@wangguan1995
Copy link
Author

请问是什么情况下 uint32 tensor 要导出到python的paddle Tensor呢? 你的需求是啥呢

我正在接入Open3D 的临近搜索算法

算法

  • 首先构建一个HashTable, 标记像素化分块的空间中,散点属于空间的那一个块
  • 其次进行固定半径的临近搜索

torch实现

  • Open3D会使用torch::Tensor创建一个int32的Tensor
  • HashTable算子:然后这个int32的tensor会cast为uint32的device数组指针,并导入到Open3D的cuda核函数中进行运算
  • python:uint32数组以int32的tensor格式保存
  • RadiusSearch算子:读取int32的tensor,再cast为unit32进行运算
  • python:获取搜索结果,删除中间变量(int32的tensor)

@wangguan1995
Copy link
Author

请问是什么情况下 uint32 tensor 要导出到python的paddle Tensor呢? 你的需求是啥呢

我正在接入Open3D 的临近搜索算法

算法

  • 首先构建一个HashTable, 标记像素化分块的空间中,散点属于空间的那一个块
  • 其次进行固定半径的临近搜索

torch实现

  • Open3D会使用torch::Tensor创建一个int32的Tensor
  • HashTable算子:然后这个int32的tensor会cast为uint32的device数组指针,并导入到Open3D的cuda核函数中进行运算
  • python:uint32数组以int32的tensor格式保存
  • RadiusSearch算子:读取int32的tensor,再cast为unit32进行运算
  • python:获取搜索结果,删除中间变量(int32的tensor)
    https://github.com/isl-org/Open3D
    image

@phlrain
Copy link
Collaborator

phlrain commented Jul 4, 2024

这个问题是这样的,框架底层的tensor是支持,只是好多算子没有适配这个unit32的逻辑,如果自定义算子适配了uint32,这个保存时能跑的通的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants