DL4J中文文档/Keras模型导入/本地层

本文深入解析了Keras中的一维局部连接层(KerasLocallyConnected1D)与二维局部连接层(KerasLocallyConnected2D),介绍了它们的构造函数、如何从配置字典中创建层、获取输出类型以及设置权重等关键操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

KerasLocallyConnected1D

[源码]

从Keras导入一维本地连接层。

KerasLocallyConnected1D

public KerasLocallyConnected1D(Integer kerasVersion) throws UnsupportedKerasConfigurationException 

从KerasLayer传递构造函数

  • 参数 kerasVersion Keras主版本
  • 抛出 UnsupportedKerasConfigurationException 不支持的 Keras 配置

getLocallyConnected1DLayer

public LocallyConnected1D getLocallyConnected1DLayer() 

获取一维本地连接层

 

   public KerasLocallyConnected1D(Map<String, Object> layerConfig)
            throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException 

来自解析的keras层配置字典的构造函数。

  • 参数 layerConfig 包含keras层配置的字典
  • 抛出 InvalidKerasConfigurationException 无效的 Keras 配置
  • 抛出 UnsupportedKerasConfigurationException 不支持的无效的 Keras 配置

getOutputType

public InputType getOutputType(InputType... inputType) throws InvalidKerasConfigurationException 

获取层输出类型

  • 参数 inputType 输入类型数组
  • 返回 按输入类型返回输出类型
  • 抛出 InvalidKerasConfigurationException 无效的 Keras 配置

setWeights

public void setWeights(Map<String, INDArray> weights) throws InvalidKerasConfigurationException 

为一维本地连接层设置权重

  • 参数 weights 从参数名映射到INDArray。

KerasLocallyConnected2D

[源码]

从Keras导入二维本地连接层。

KerasLocallyConnected2D

public KerasLocallyConnected2D(Integer kerasVersion) throws UnsupportedKerasConfigurationException 

从KerasLayer传递构造函数

  • 参数 kerasVersion Keras主版本
  • 抛出 UnsupportedKerasConfigurationException 不支持的 Keras 配置

getLocallyConnected2DLayer

public LocallyConnected2D getLocallyConnected2DLayer() 

获取二维本地连接层。

 

   public KerasLocallyConnected2D(Map<String, Object> layerConfig)
            throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException 

来自解析的keras层配置字典的构造函数。

  • 参数 layerConfig 包含keras层配置的字典
  • 抛出 InvalidKerasConfigurationException 无效的 Keras 配置
  • 抛出 UnsupportedKerasConfigurationException 不支持的无效的 Keras 配置

 

getOutputType

public InputType getOutputType(InputType... inputType) throws InvalidKerasConfigurationException 

获取层输出类型

  • 参数 inputType 输入类型数组
  • 返回 按输入类型返回输出类型
  • 抛出 InvalidKerasConfigurationException 无效的 Keras 配置

setWeights

public void setWeights(Map<String, INDArray> weights) throws InvalidKerasConfigurationException 

为二维本地连接层设置权重

  • 参数 weights 从参数名映射到INDArray。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值