PaddlePaddle / Paddle

PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice (『飞桨』核心框架,深度学习&机器学习高性能单机、分布式训练和跨平台部署)
http://www.paddlepaddle.org/
Apache License 2.0
22.18k stars 5.57k forks source link

uint8类型的tensor无法切片 #45357

Open flytocc opened 2 years ago

flytocc commented 2 years ago

报错信息

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
/tmp/ipykernel_168/1390243965.py in <module>
----> 1 u8_data_cpu[0]

/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/varbase_patch_methods.py in __getitem__(self, item)
    738         else:
    739             # 2. Call c++ func getitem_index_not_tensor to speedup.
--> 740             return self._getitem_index_not_tensor(item)
    741 
    742     def __setitem__(self, item, value):

RuntimeError: (NotFound) Operator slice does not have kernel for {data_type[uint8_t]; data_layout[Undefined(AnyLayout)]; place[Place(cpu)]; library_type[PLAIN]}.
  [Hint: Expected kernel_iter != kernels.end(), but received kernel_iter == kernels.end().] (at /paddle/paddle/fluid/imperative/prepared_operator.cc:403)
  [operator < slice > error]

复现代码

import paddle
from paddle.fluid import core

u8_data = paddle.empty(shape=[2, 3, 4, 4], dtype=paddle.uint8)

u8_data_gpu = paddle.to_tensor(u8_data, place=core.CUDAPlace(0))
u8_data_cpu = paddle.to_tensor(u8_data, place=core.CPUPlace())

u8_data_cpu[0]
u8_data_gpu[0]
paddle-bot[bot] commented 2 years ago

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网API文档常见问题历史IssueAI社区来寻求解答。祝您生活愉快~

Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the APIFAQGithub Issue and AI community to get the answer.Have a nice day!

lyuwenyu commented 2 years ago

多谢反馈

BhAem commented 2 years ago

请问解决了吗

flytocc commented 1 year ago

paddle2.4.2 仍未支持uint8类型的切片操作