博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【解决错误】The size of tensor a (8) must match the size of tensor b (64) at non-singleton dimension 1
阅读量:2134 次
发布时间:2019-04-30

本文共 362 字,大约阅读时间需要 1 分钟。

一、报错

RuntimeError: Given groups=1, weight of size 64 64 1 1, expected input[16, 48, 40, 40] to have 64 channels, but got 48 channels instead

二、原因

  • 错误分析:这里面说的是要求输入的权重是[64,64,1,1],其中第二个维度的要求是64,但是给定的输入却是[16, 48, 40, 40],导致输入的第二个维度48和64不匹配。

三、解决方案

  • 一般出错都是在卷积层的输出的维度匹配不上下一个卷积层要求的输出维度,这时候我们要仔细检查上一层卷积的out_channel是否和下一层卷积的in_channel一模一样。
  • 当然还要注意concatenation拼接等操作引起的维度变化。

转载地址:http://sdugf.baihongyu.com/

你可能感兴趣的文章
【LEETCODE】172-Factorial Trailing Zeroes
查看>>
【LEETCODE】112-Path Sum
查看>>
【LEETCODE】9-Palindrome Number
查看>>
【极客学院】-python学习笔记-Python快速入门(面向对象-引入外部文件-Web2Py创建网站)
查看>>
【LEETCODE】190-Reverse Bits
查看>>
【LEETCODE】67-Add Binary
查看>>
【LEETCODE】7-Reverse Integer
查看>>
【LEETCODE】165-Compare Version Numbers
查看>>
【LEETCODE】299-Bulls and Cows
查看>>
【LEETCODE】223-Rectangle Area
查看>>
【LEETCODE】12-Integer to Roman
查看>>
【学习方法】如何分析源代码
查看>>
【LEETCODE】61- Rotate List [Python]
查看>>
【LEETCODE】143- Reorder List [Python]
查看>>
【LEETCODE】82- Remove Duplicates from Sorted List II [Python]
查看>>
【LEETCODE】86- Partition List [Python]
查看>>
【LEETCODE】147- Insertion Sort List [Python]
查看>>
【算法】- 动态规划的编织艺术
查看>>
用 TensorFlow 让你的机器人唱首原创给你听
查看>>
对比学习用 Keras 搭建 CNN RNN 等常用神经网络
查看>>