File ~\anaconda4\envs\tensorflow\lib\site-packages\tensorflow\python\ops\array_ops.py:2122 in transpose return transpose_fn(a, perm, name=name) File ~\anaconda4\envs\tensorflow\lib\site-packages\tensorflow\python\ops\gen_array_ops.py:11173 in transpose return transpose_eager_fallback( File ~\anaconda4\envs\tensorflow\lib\site-packages\tensorflow\python\ops\gen_array_ops.py:11200 in transpose_eager_fallback _result = _execute.execute(b"Transpose", 1, inputs=_inputs_flat, File ~\anaconda4\envs\tensorflow\lib\site-packages\tensorflow\python\eager\execute.py:59 in quick_execute tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name, InvalidArgumentError: transpose expects a vector of size 4. But input(1) is a vector of size 3 [Op:Transpose] 2023-05-24 00:30:37.873862: W tensorflow/core/framework/op_kernel.cc:1753] OP_REQUIRES failed at transpose_op.cc:157 : Invalid argument: transpose expects a vector of size 4. But input(1) is a vector of size 3
时间: 2023-06-30 08:05:03 浏览: 193
人工智能实践:Tensorflow笔记00:anaconda,tensorflow,pycharm等一系列的安装与配置。
这个错误是因为你正在尝试对一个形状为 (?,?,?) 的张量进行转置,但是转置操作需要的 perm 参数是一个长度为 4 的向量。你需要检查一下你的代码,看看是否有错误地创建了一个形状为 (?,?,?) 的张量,或者在调用转置操作时传递了错误的 perm 参数。你可以尝试打印出相关张量的形状,以便更好地理解问题所在。
阅读全文