3
$\begingroup$

I'm studying neural networks but haven't yet studied CNNs in depth.

I'm wondering whether we can use a matrix as input for feedforward neural networks? Or can we only use vectors as input for feedforward NNs?

I'm asking this because in all the practical examples I've worked with I had to flatten the input matrix (for example images) to use it as an input in form of a vector.

$\endgroup$
5
  • 1
    $\begingroup$ Yes, of course. Most neural network libraries in fact accept tensors (sic). E.g. an image is usually a 3 dimensional array (3 rgb layers of 2d values). $\endgroup$ May 1, 2021 at 11:43
  • $\begingroup$ Do you mean the theory or the software implementation? $\endgroup$
    – Dave
    May 1, 2021 at 12:56
  • $\begingroup$ @Dave I mean the software implementation. $\endgroup$
    – LeLuc
    May 1, 2021 at 14:29
  • $\begingroup$ @conjectures Is that also true for feedforward NNs? Or would we have to use a CNN architecture? $\endgroup$
    – LeLuc
    May 1, 2021 at 14:30
  • 1
    $\begingroup$ This is almost always true. In TF/Keras, which is what I know, one can pass in multiple multidimensional arrays (which cat pic is cuter?). Of course using fancy things gets more complicated but one can do it. (Also, I would say CNN is a feed forward network of a particular kind.) $\endgroup$ May 1, 2021 at 20:50

1 Answer 1

1
$\begingroup$

CNNs for image recognition can take in not just a matrix but also a MxNx3 array (width, height, RGB channels). In fact, they can take in any array shape.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.