PaddlePaddle / PaddlePaddle/FastDeploy

FDtensor 多次获取输出结果异常

Open
#2,302 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.7k
Forks
756
Avg merge
19h 28m
Merged PRs (30d)
4

Description


温馨提示:根据社区不完全统计,按照模板提问,可以加快回复和解决问题的速度


环境

  • 【FastDeploy版本】: 说明具体的版本,如fastdeploy-linux-gpu-0.8.0
  • 【编译命令】如果您是自行编译的FastDeploy,请说明您的编译方式(参数命令)
  • 【系统平台】: Linux x64(Ubuntu 18.04) / Windows x64(Windows10) / Mac OSX arm(12.0) / Mac OSX intel(12.0)
  • 【硬件】: 说明具体硬件型号,如 Nvidia GPU 3080TI, CUDA 11.2 CUDNN 8.3
  • 【编译语言】: C++ / Python(3.7或3.8等)

问题日志及出现问题的操作流程

在一个class里面初始化成员变量,通过SetData方式创建FDtensor,获取tensor的值正常。在该class的其他成员函数再次获取tensor值的时候,结果发生了变化。
参考代码如下

    std::vector<float> yaw_(120);
    std::iota(yaw_.begin(),yaw_.end(),0);
    yaw_idx_.SetData({120}, FDDataType::FP32, yaw_.data());
    yaw_idx_.PrintInfo();
    std::vector<float> data;
    data.resize(yaw_idx_.Numel());
    std::memcpy(data.data(), yaw_idx_.Data(), yaw_idx_.Nbytes());

    for(size_t i=0; i<data.size();i++){
        std::cout<<data[i]<<",";
    }

两次调用上述代码块,得到的结果不一致

Debug TensorInfo: : name=, shape=120 , buffer_=0, external_data_ptr=0x4bd78c0, dtype=FDDataType::FP32, mean=59.5, max=119, min=0
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,

Debug TensorInfo: : name=, shape=120 , buffer_=0, external_data_ptr=0x4bd78c0, dtype=FDDataType::FP32, mean=6.41035e+29, max=7.68307e+31, min=-3576.39
-3569.44,4.56837e-41,1.4013e-45,1.4013e-45,-3576.39,4.56837e-41,4.45452e-36,0,5.04467e-44,0,5.04467e-44,0,12,13,4.45448e-36,0,0,0,18,19,20,21,0,0,24,25,4.4545e-36,0,0,0,30,31,32,33,0,35,36,37,6.86636e-44,0,7.68307e+31,6.97683e+22,2.73716e+20,1.89362e+23,2.73758e+20,1.46644e-19,7.56562e+28,3.86892e-11,5.27204e-14,49,2.25609e-43,0,-3569.44,4.56837e-41,1.4013e-45,1.4013e-45,-3576.39,4.56837e-41,756.665,0,5.88545e-44,0,5.88545e-44,0,64,65,4.45456e-36,0,0,0,70,71,72,73,0,0,76,77,4.45458e-36,0,0,0,82,83,84,85,1.4013e-45,87,88,89,6.86636e-44,0,50512.3,6.40997e-10,1.73878e+25,2.06165e-19,5.2638e+25,3.78335e-39,98,99,100,101,6.86636e-44,0,1.7752e+28,1.78169e-19,1.06455e+24,1.73879e+25,2.06165e-19,5.14043e+22,3.80632e-39,111,112,113,4.62428e-44,0,1.4013e-45,0,1.68156e-43,0,

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the shown C++ sequence that calls SetData, Data, Numel, Nbytes, and PrintInfo twice on the same FDTensor. Inspect the tensor's external data ownership and lifetime around repeated reads; done when the second read reliably matches the initialized values.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.