自定义层的实现
发布时间
阅读量:
阅读量
Implementing custom layers
A recommended approach to creating your custom layer is to extend the tf.keras.Layer class and implement:
- In init, handle all input-agnostic initialization.
- In build, when you are aware of the shapes of input tensors, perform the remaining initialization steps.
- In call, perform forward computation.
Please note that you don't need to wait until the build function is executed before setting up your variables; you can also initialize them during the init phase. One key advantage of performing variable setup within the build function is that it a
全部评论 (0)
还没有任何评论哟~
