The Keras' documentation describes here how to write a custom layer by inheriting from the Layer
class. Now, I have another custom layer CustomLayer
, from which I want to inherit. Let's call my new custom layer CustomLayer2
. I guess that the process of inheriting, even though I will not be inheriting from Layer
but from CustomLayer
, will be the same described in the linked documentation, but I will also inherit the custom functionality of CustomLayer
.
Anyway, inside this custom layer CustomLayer2
I want to implement some logic that is based on the current epoch or step of the epoch.
How can I do that? How can I dynamically get the current epoch or step of the epoch from the call
and/or build
methods of the layer?
Maybe this can be done with callbacks. For example, I could have a callback that accesses an instance of the model and then changes something inside the model. I don't like much this solution, but if it works, that's fine. But can we change the logic of the layers of a model from an instance of a model?
In the past, two similar questions have been asked