Keras的Layer其实就是一个Class, 要具有以下几个方法:

(1) build(input_shape): 定义权重的地方, 如果不需要定义权重, 也要有self.built = True;

(2) call(x): 编写功能逻辑的地方, 实现Layer的功能逻辑;

(3) compute_output_shape(input_shape): 根据input_shape, 计算形状变化的地方, 能够让Keras推断输出的Tensor的Shape.

 

相关文章:

  • 2021-05-18
  • 2021-02-16
  • 2022-03-07
  • 2021-08-30
  • 2022-12-23
  • 2021-05-11
  • 2022-01-21
  • 2022-12-23
猜你喜欢
  • 2021-07-19
  • 2021-12-18
  • 2022-12-23
  • 2022-03-07
  • 2022-12-23
  • 2021-08-31
相关资源
相似解决方案