MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / dense

Function dense

tensorflow/python/layers/core.py:116–187  ·  view source on GitHub ↗

Functional interface for the densely-connected layer. This layer implements the operation: `outputs = activation(inputs * kernel + bias)` where `activation` is the activation function passed as the `activation` argument (if not `None`), `kernel` is a weights matrix created by the layer, a

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

Source from the content-addressed store, hash-verified

114 date=None, instructions='Use keras.layers.Dense instead.')
115@tf_export(v1=['layers.dense'])
116def dense(
117 inputs, units,
118 activation=None,
119 use_bias=True,
120 kernel_initializer=None,
121 bias_initializer=init_ops.zeros_initializer(),
122 kernel_regularizer=None,
123 bias_regularizer=None,
124 activity_regularizer=None,
125 kernel_constraint=None,
126 bias_constraint=None,
127 trainable=True,
128 name=None,
129 reuse=None):
130 """Functional interface for the densely-connected layer.
131
132 This layer implements the operation:
133 `outputs = activation(inputs * kernel + bias)`
134 where `activation` is the activation function passed as the `activation`
135 argument (if not `None`), `kernel` is a weights matrix created by the layer,
136 and `bias` is a bias vector created by the layer
137 (only if `use_bias` is `True`).
138
139 Arguments:
140 inputs: Tensor input.
141 units: Integer or Long, dimensionality of the output space.
142 activation: Activation function (callable). Set it to None to maintain a
143 linear activation.
144 use_bias: Boolean, whether the layer uses a bias.
145 kernel_initializer: Initializer function for the weight matrix.
146 If `None` (default), weights are initialized using the default
147 initializer used by `tf.compat.v1.get_variable`.
148 bias_initializer: Initializer function for the bias.
149 kernel_regularizer: Regularizer function for the weight matrix.
150 bias_regularizer: Regularizer function for the bias.
151 activity_regularizer: Regularizer function for the output.
152 kernel_constraint: An optional projection function to be applied to the
153 kernel after being updated by an `Optimizer` (e.g. used to implement
154 norm constraints or value constraints for layer weights). The function
155 must take as input the unprojected variable and must return the
156 projected variable (which must have the same shape). Constraints are
157 not safe to use when doing asynchronous distributed training.
158 bias_constraint: An optional projection function to be applied to the
159 bias after being updated by an `Optimizer`.
160 trainable: Boolean, if `True` also add variables to the graph collection
161 `GraphKeys.TRAINABLE_VARIABLES` (see `tf.Variable`).
162 name: String, the name of the layer.
163 reuse: Boolean, whether to reuse the weights of a previous layer
164 by the same name.
165
166 Returns:
167 Output tensor the same shape as `inputs` except the last dimension is of
168 size `units`.
169
170 Raises:
171 ValueError: if eager execution is enabled.
172 """
173 layer = Dense(units,

Callers 15

bodyMethod · 0.85
testCallMethod · 0.85
testCallTensorDotMethod · 0.85
testNoBiasMethod · 0.85
testNonTrainableMethod · 0.85
testOutputShapeMethod · 0.85
testCallOnPlaceHolderMethod · 0.85
testActivationMethod · 0.85
testKernelRegularizerMethod · 0.85
testBiasRegularizerMethod · 0.85

Calls 2

DenseClass · 0.70
applyMethod · 0.45

Tested by 15

bodyMethod · 0.68
testCallMethod · 0.68
testCallTensorDotMethod · 0.68
testNoBiasMethod · 0.68
testNonTrainableMethod · 0.68
testOutputShapeMethod · 0.68
testCallOnPlaceHolderMethod · 0.68
testActivationMethod · 0.68
testKernelRegularizerMethod · 0.68
testBiasRegularizerMethod · 0.68