神经网络参数中的jax空元素
我正在努力实施一个非常小的神经网络。 My network is as follows:
init_random_params, predict = stax.serial(
Dense(1024), Relu,
Dense(1024), Relu,
Dense(10), LogSoftmax)
I have initialized the neural network as follows:
_, init_params = init_random_params(rng, (-1, 28 * 28))
params = init_params
when I print the parameters of neural network it is a tuple of size 6. In fact param[0]
and param[ 2]
和param [4]
是非空的,由相应层的重量和偏置组成。但是,其余元素,即,param [1]
和param [3]
和param [5]
简直是空。
我想了解这背后的原因,因为这使我很难实施一些我感兴趣的培训算法。
I am working on the implementation of a very small neural network. My network is as follows:
init_random_params, predict = stax.serial(
Dense(1024), Relu,
Dense(1024), Relu,
Dense(10), LogSoftmax)
I have initialized the neural network as follows:
_, init_params = init_random_params(rng, (-1, 28 * 28))
params = init_params
when I print the parameters of neural network it is a tuple of size 6. In fact param[0]
and param[2]
and param[4]
are non-empty and consists of weight and bias of the corresponding layers. However, the rest of elements, i.e., param[1]
and param[3]
and param[5]
are simply empty.
I would like to understand the reason behind this because it makes it difficult for me to implement some training algorithms that I am interested.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否使用
stax
有什么特殊原因?引用stax
::如果您在使用STAX创建神经网络时遇到困难,则可以尝试使用积极支持的神经网络库。
也就是说,我相信这些条目中没有参数的原因是
relu
和logSoftMax
不需要任何参数。Is there any particular reason you're using
stax
? Quoting from thestax
module docstring:If you're having trouble creating neural networks with stax, you might try using an actively supported neural network library instead.
That said, I believe the reason there are no parameters in these entries is because
ReLu
andLogSoftmax
do not require any parameters.