Assign requires shapes of both tensors to match. lhs shape= [4096,1470] rhs shape= [4096,539]

Assign requires shapes of both tensors to match. lhs shape= [4096,1470] rhs shape= [4096,539]

报错如下

Assign requires shapes of both tensors to match. lhs shape= [4096,1470] rhs shape= [4096,539]

解决方法

笔者报错是由于训练类别与测试类别的配置参数不对应!

  • 将下列代码:
    Assign requires shapes of both tensors to match. lhs shape= [4096,1470] rhs shape= [4096,539]
  • 改为(自己训练的数据类别):Assign requires shapes of both tensors to match. lhs shape= [4096,1470] rhs shape= [4096,539]
  • 即可!