KerasEmbedding
从Keras导入一个嵌入层
KerasEmbedding
public KerasEmbedding() throws UnsupportedKerasConfigurationException
![](https://img.haomeiwen.com/i14495907/e17eeab997e5548f.gif)
为单元测试传递构造函数
- 抛出 UnsupportedKerasConfigurationException 不支持的 Keras 配置
getEmbeddingLayer
public EmbeddingSequenceLayer getEmbeddingLayer()
![](https://img.haomeiwen.com/i14495907/1e9bd0d4239b99d4.gif)
获取嵌入层
public KerasEmbedding(Map<String, Object> layerConfig)
throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException
![](https://img.haomeiwen.com/i14495907/1d5ec4fb8bbe27ba.gif)
来自解析的keras层配置字典的构造函数。
- 参数 layerConfig 包含keras层配置的字典
- 抛出 InvalidKerasConfigurationException 无效的 Keras 配置
- 抛出 UnsupportedKerasConfigurationException 不支持的无效的 Keras 配置
getOutputType
public InputType getOutputType(InputType... inputType) throws InvalidKerasConfigurationException
![](https://img.haomeiwen.com/i14495907/86a244e8605ed2bd.gif)
获取层输出类型
- 参数 inputType 输入类型数组
- 返回 按输入类型返回输出类型
- 抛出 InvalidKerasConfigurationException 无效的 Keras 配置
getNumParams
public int getNumParams()
![](https://img.haomeiwen.com/i14495907/828480cbfe19ac97.gif)
返回层中可训练参数的数目。
setWeights
public void setWeights(Map<String, INDArray> weights) throws InvalidKerasConfigurationException
![](https://img.haomeiwen.com/i14495907/85ff4a4b1e101f98.gif)
为层设置权重
- 参数 weights 嵌入层权重
网友评论