It looks like the input to your first fully connected layer doesn’t match the requires shape. The view will yield a shape of [?, 7744] while the  layer expects an input shape of [?, 400] as 400 = 16 * 5 * 5.