其他分享
首页 > 其他分享> > Tensorflow 添加全连接层

Tensorflow 添加全连接层

作者:互联网

Tensorflow中提供了tf.layers.dense()tf.contrib.layers.fully_connected用于添加全连接层,两者功能一样,后者在前者基础上封装实现。

1. tf.layers.dense()

tf.layers.dense(
    inputs,
    units,
    activation=None,
    use_bias=True,
    kernel_initializer=None,
    bias_initializer=tf.zeros_initializer(),
    kernel_regularizer=None,
    bias_regularizer=None,
    activity_regularizer=None,
    kernel_constraint=None,
    bias_constraint=None,
    trainable=True,
    name=None,
    reuse=None
)

2. tf.contrib.layers.fully_connected

tf.contrib.layers.fully_connected(
    inputs,
    num_outputs,
    activation_fn=tf.nn.relu,
    normalizer_fn=None,
    normalizer_params=None,
    weights_initializer=initializers.xavier_initializer(),
    weights_regularizer=None,
    biases_initializer=tf.zeros_initializer(),
    biases_regularizer=None,
    reuse=None,
    variables_collections=None,
    outputs_collections=None,
    trainable=True,
    scope=None
)
apr15 发布了3 篇原创文章 · 获赞 2 · 访问量 112 私信 关注

标签:None,regularizer,bias,initializer,添加,biases,tf,Tensorflow,连接
来源: https://blog.csdn.net/apr15/article/details/104591771