How are padded values used?

In NLP we were taught to make the input size constant by padding sentences shorter than the target length. My question is how does the NNs treat them internally:

  • Is there logic to exclude the zero values from the weights & biases? Or
  • Are the zeros simply left in there and the NN figures out they hold no value?

Hi @sunukp,

As you mentioned, what you’re doing when padding is just to keep input size constant. Doing so, you enlarge the parameter space although also allow code to efficiently perform matrix operations for your algorithms.

Having said that, no need to add any logic. Your network will figure out that the padded values you have added are meaningless.

Hope it helps,