KerasBidirectional
从Keras双向层包装器构建DL4J双向层
KerasBidirectional
public KerasBidirectional(Integer kerasVersion) throws UnsupportedKerasConfigurationException
![](https://img.haomeiwen.com/i14495907/fe7ad6d314fba2b2.gif)
从KerasLayer传递构造函数
- 参数 kerasVersion Keras主版本
- 抛出 UnsupportedKerasConfigurationException 不支持的 Keras 配置
getUnderlyingRecurrentLayer
public Layer getUnderlyingRecurrentLayer()
![](https://img.haomeiwen.com/i14495907/2a27b1f230db1637.gif)
获取底层循环层
public KerasBidirectional(Map<String, Object> layerConfig)
throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException
![](https://img.haomeiwen.com/i14495907/129e0e5d2db93969.gif)
来自解析的keras层配置字典的构造函数。
- 参数 layerConfig 包含keras层配置的字典
- 抛出 InvalidKerasConfigurationException 无效的 Keras 配置
- 抛出 UnsupportedKerasConfigurationException 不支持的无效的 Keras 配置
getBidirectionalLayer
public Bidirectional getBidirectionalLayer()
![](https://img.haomeiwen.com/i14495907/13265f38764bf772.gif)
获取 DL4J 的双向层。
- 返回双向层
getOutputType
public InputType getOutputType(InputType... inputType) throws InvalidKerasConfigurationException
![](https://img.haomeiwen.com/i14495907/b2396f1736f9bfaa.gif)
获取层输出类型
- 参数 inputType 输入类型数组
- 返回 按输入类型返回输出类型
- 抛出 InvalidKerasConfigurationException 无效的 Keras 配置
getNumParams
public int getNumParams()
![](https://img.haomeiwen.com/i14495907/a0d35700d6b27a0a.gif)
返回层中可训练的参数
getInputPreprocessor
public InputPreProcessor getInputPreprocessor(InputType... inputType) throws InvalidKerasConfigurationException
![](https://img.haomeiwen.com/i14495907/8d42d006b986fda3.gif)
为给定的输入类型获取适合的DL4J输入预处理器
- 参数 inputType 输入类型数组
- 返回 DL4J 输入预处理器
- 抛出 InvalidKerasConfigurationException 无效的 Keras 配置
- 查看 org.deeplearning4j.nn.conf.InputPreProcessor
setWeights
public void setWeights(Map<String, INDArray> weights) throws InvalidKerasConfigurationException
![](https://img.haomeiwen.com/i14495907/5a59a78f539a299d.gif)
设置层的权重
- 参数 weights 权重映射。
网友评论