Skip to content

  • 体验新版
    • 正在加载...
  • 登录
  • PaddlePaddle
  • Paddle
  • Issue
  • #22159

P
Paddle
  • 项目概览

PaddlePaddle / Paddle
大约 2 年 前同步成功

通知 2325
Star 20933
Fork 5424
  • 代码
    • 文件
    • 提交
    • 分支
    • Tags
    • 贡献者
    • 分支图
    • Diff
  • Issue 1423
    • 列表
    • 看板
    • 标记
    • 里程碑
  • 合并请求 543
  • Wiki 0
    • Wiki
  • 分析
    • 仓库
    • DevOps
  • 项目成员
  • Pages
P
Paddle
  • 项目概览
    • 项目概览
    • 详情
    • 发布
  • 仓库
    • 仓库
    • 文件
    • 提交
    • 分支
    • 标签
    • 贡献者
    • 分支图
    • 比较
  • Issue 1,423
    • Issue 1,423
    • 列表
    • 看板
    • 标记
    • 里程碑
  • 合并请求 543
    • 合并请求 543
  • Pages
  • 分析
    • 分析
    • 仓库分析
    • DevOps
  • Wiki 0
    • Wiki
  • 成员
    • 成员
  • 收起侧边栏
  • 动态
  • 分支图
  • 创建新Issue
  • 提交
  • Issue看板
已关闭
开放中
Opened 1月 08, 2020 by saxon_zh@saxon_zhGuest

transpose操作dimension问题

Created by: hxk11111

  • 版本、环境信息: 1)PaddlePaddle版本:1.6.2 2)python:3.6.3

  • 训练信息 1)单机单卡

  • 问题描述

image_input = fluid.layers.data(name="image",
                                  shape=[512,
                                         512,
                                         self.image_channels],
                                  dtype="float32")
image_feature = fluid.layers.transpose(image_input, perm=[0, 3, 1, 2])
image_feature = fluid.layers.conv2d(image_feature, num_filters=16, filter_size=3, act="leaky_relu")

打印image的shape为(-1, 512, 512, 1) 但在transpose操作中报错,说 tensor's dimension is 3, axis's size is 4,tensor的dimension不应该是4吗

1578452769              The place is:CUDAPlace(0)
Tensor[image]
        shape: [512,512,1,]
        dtype: f
        data: 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
/opt/conda/envs/table_parsing/lib/python3.7/site-packages/paddle/fluid/executor.py:779: UserWarning: The following exception is not an EOF exception.
  "The following exception is not an EOF exception.")
Traceback (most recent call last):
  File "models/train.py", line 180, in <module>
    train()
  File "models/train.py", line 159, in train
    results = train_one_batch(feed_data)
  File "models/train.py", line 103, in train_one_batch
    fetch_list=fetch_vars)
  File "/opt/conda/envs/table_parsing/lib/python3.7/site-packages/paddle/fluid/executor.py", line 780, in run
    six.reraise(*sys.exc_info())
  File "/opt/conda/envs/table_parsing/lib/python3.7/site-packages/six.py", line 696, in reraise
    raise value
  File "/opt/conda/envs/table_parsing/lib/python3.7/site-packages/paddle/fluid/executor.py", line 775, in run
    use_program_cache=use_program_cache)
  File "/opt/conda/envs/table_parsing/lib/python3.7/site-packages/paddle/fluid/executor.py", line 822, in _run_impl
    use_program_cache=use_program_cache)
  File "/opt/conda/envs/table_parsing/lib/python3.7/site-packages/paddle/fluid/executor.py", line 899, in _run_program
    fetch_var_name)
paddle.fluid.core_avx.EnforceNotMet:

--------------------------------------------
C++ Call Stacks (More useful to developers):
--------------------------------------------
0   std::string paddle::platform::GetTraceBackString<std::string const&>(std::string const&, char const*, int)
1   paddle::platform::EnforceNotMet::EnforceNotMet(std::string const&, char const*, int)
2   paddle::operators::TransposeOp::InferShape(paddle::framework::InferShapeContext*) const
3   paddle::operators::Transpose2Op::InferShape(paddle::framework::InferShapeContext*) const
4   paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, paddle::platform::Place const&, paddle::framework::RuntimeContext*) const
5   paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, paddle::platform::Place const&) const
6   paddle::framework::OperatorBase::Run(paddle::framework::Scope const&, paddle::platform::Place const&)
7   paddle::framework::Executor::RunPreparedContext(paddle::framework::ExecutorPrepareContext*, paddle::framework::Scope*, bool, bool, bool)
8   paddle::framework::Executor::Run(paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool, std::vector<std::string, std::allocator<std::string> > const&, bool)

------------------------------------------
Python Call Stacks (More useful to users):
------------------------------------------
  File "/opt/conda/envs/table_parsing/lib/python3.7/site-packages/paddle/fluid/framework.py", line 2488, in append_op
    attrs=kwargs.get("attrs", None))
  File "/opt/conda/envs/table_parsing/lib/python3.7/site-packages/paddle/fluid/layer_helper.py", line 43, in append_op
    return self.main_program.current_block().append_op(*args, **kwargs)
  File "/opt/conda/envs/table_parsing/lib/python3.7/site-packages/paddle/fluid/layers/nn.py", line 8100, in transpose
    attrs={'axis': perm})
  File "/root/paddle/GNN-Table-Parsing/models/image_conv_block.py", line 18, in build_image_conv_block
    image_feature = fluid.layers.transpose(image_input, perm=[0, 3, 1, 2])
  File "/root/paddle/GNN-Table-Parsing/models/gnn_model.py", line 117, in build_node_features
    image_features = image_conv_block.build_image_conv_block(image)
  File "/root/paddle/GNN-Table-Parsing/models/gnn_model.py", line 282, in build_model
    node_features = self.build_node_features(image, vertex_text, vertex_features)
  File "/root/paddle/GNN-Table-Parsing/models/gnn_model.py", line 310, in train_net
    edge_output_list = self.build_model()
  File "models/train.py", line 58, in train
    accuracies, inference_program = gnn_model.train_net()
  File "models/train.py", line 180, in <module>
    train()

----------------------
Error Message Summary:
----------------------
Error: ShapeError: The input tensor's dimension should be equal to the axis's size. But received input tensor's dimension is 3, axis's size is 4
  [Hint: Expected x_rank == axis_size, but received x_rank:3 != axis_size:4.] at (/paddle/paddle/fluid/operators/transpose_op.cc:46)
  [operator < transpose2 > error]
指派人
分配到
无
里程碑
无
分配里程碑
工时统计
无
截止日期
无
标识: paddlepaddle/Paddle#22159
渝ICP备2023009037号

京公网安备11010502055752号

网络110报警服务 Powered by GitLab CE v13.7
开源知识
Git 入门 Pro Git 电子书 在线学 Git
Markdown 基础入门 IT 技术知识开源图谱
帮助
使用手册 反馈建议 博客
《GitCode 隐私声明》 《GitCode 服务条款》 关于GitCode
Powered by GitLab CE v13.7