NaN training loss

Why am I having NaN for training loss, ltrain if I change the variable NUM_OF_CELLS from 8 to 16 ?

Problem solved with some weight regularization