<p>I have noticed that almost all tutorials take the number of neurons as a power of 2. Is there any proper mathematical and well-proven reason for that? </p>

<p>If you sometimes change it to some other odd value, then we get a very long and weird error calling about a dozen things making the traceback of a page. Is there any reason for that?      </p>

<blockquote>
  <p>I had tried it on a text predicting RNN with some GRU and LSTM layers mixed (bidirectional). I changed the no. of neuron units and It also resulted in an error. So, any ideas/theories?</p>
</blockquote>

CC BY-SA 4.0
2020-04-21T20:54:29.217Z
Hi and welcome to AI SE! You say "If you sometimes change it to some other odd value, then we get a very long and weird error calling about a dozen things making the traceback of a page", but I don't think this is caused by the fact that the number of neurons is not a power of 2. So, can you provide a concrete example where that occurs? Also, note that, for each layer, you may have a different number of neurons.
nbro
CC BY-SA 4.0
2020-04-22T17:50:09.240Z
@nbro, No I do not have a concrete example. I have just migrated to another OS so most of my code is lost. But even then in most tutorials the no. is always a power of 2. So I was wondering what reason was there behind it.....
neel g
<neural-networks><machine-learning><ai-design><hyper-parameters>
Why is the number of neurons used in various neural networks power of 2?
neel g
# Why is the number of neurons used in various neural networks power of 2?

(Asked by: username_0 on 2020-04-21)

I have noticed that almost all tutorials take the number of neurons as a power of 2. Is there any proper mathematical and well-proven reason for that?

If you sometimes change it to some other odd value, then we get a very long and weird error calling about a dozen things making the traceback of a page. Is there any reason for that?

> I had tried it on a text predicting RNN with some GRU and LSTM layers mixed (bidirectional). I changed the no. of neuron units and It also resulted in an error. So, any ideas/theories?

**Tags:** neural-networks, machine-learning, ai-design, hyper-parameters

> **Comments:**
> **username_1**: Hi and welcome to AI SE! You say "If you sometimes change it to some other odd value, then we get a very long and weird error calling about a dozen things making the traceback of a page", but I don't think this is caused by the fact that the number of neurons is not a power of 2. So, can you provide a concrete example where that occurs? Also, note that, for each layer, you may have a different number of neurons.  
> **username_0**: @username_1, No I do not have a concrete example. I have just migrated to another OS so most of my code is lost. But even then in most tutorials the no. is always a power of 2. So I was wondering what reason was there behind it.....  

---

## 0 answers

