Custom Layer Learnable Parameters Initialization.

4 次查看(过去 30 天)
Hi!
I created a Custom Layer with Learnable Parameters (https://www.mathworks.com/help/deeplearning/ug/define-custom-deep-learning-layer.html)
However, to initialize these parameters I need to know the outputsize of the previous layer. I noticed that some pre-defined layers such as FullyConnected automaticly initialize its own weights using information from previous layers. Is there a way to automatize the weights initialization on custom layers at network initialization?
David

采纳的回答

Joss Knight
Joss Knight 2023-1-16

更多回答(1 个)

John Smith
John Smith 2021-10-4
Unfortunately, at least as of version 2021a, Matlab doesn't provide staright forward capabilities to automatically initialize learnable parameters of a custom layer similar to its built-in layers.
There's a workaround though using a shadow built-in network nested inside your custom layer (see here). Matlab will automatically initialize this layer from which learnable parameters you can pick up the values that you need.
It's a kludge, but it works (I've implemented such a scheme myself.

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

标签

产品


版本

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by