Dense 与 layers.fully_connected 有什么区别

两者有什么区别


黎明的星星 2018-4-23 16:46:14

从这里的代码看,layers.fully_connected 应该是在 Dense 的基础上简单包了一层来实现的。


舟 3332 发表于 2018-4-23 20:25:44

其实是没有区别的,,区别在于调用的参数。。。


ViolinSolo 发表于 2018-7-3 20:50:29

参考这段代码

with variable_scope.variable_scope (
      scope,
      'fully_connected', [inputs],
      reuse=reuse,
      custom_getter=layer_variable_getter) as sc:
    inputs = ops.convert_to_tensor (inputs)
    layer = core_layers.Dense (
        units=num_outputs,
        activation=None,
        use_bias=not normalizer_fn and biases_initializer,
        kernel_initializer=weights_initializer,
        bias_initializer=biases_initializer,
        kernel_regularizer=weights_regularizer,
        bias_regularizer=biases_regularizer,
        activity_regularizer=None,
        trainable=trainable,
        name=sc.name,
        dtype=inputs.dtype.base_dtype,
        _scope=sc,
        _reuse=reuse)
    outputs = layer.apply (inputs)

neverchange 发表于 2018-7-4 11:14:00