contrib.layers.bias_add
tf.contrib.layers.bias_add
tf.contrib.layers.bias_add
bias_add( inputs, activation_fn=None, initializer=tf.zeros_initializer(), regularizer=None, reuse=None, variables_collections=None, outputs_collections=None, trainable=True, data_format=DATA_FORMAT_NHWC, scope=None )
Defined in tensorflow/contrib/layers/python/layers/layers.py
.
Adds a bias to the inputs.
Can be used as a normalizer function for conv2d and fully_connected.
Args:
-
inputs
: A tensor of with at least rank 2 and value for the last dimension, e.g.[batch_size, depth]
,[None, None, None, depth]
. -
activation_fn
: Activation function, default set to None to skip it and maintain a linear activation. -
initializer
: An initializer for the bias, defaults to 0. -
regularizer
: A regularizer like the result ofl1_regularizer
orl2_regularizer
. -
reuse
: Whether or not the layer and its variables should be reused. To be able to reuse the layer scope must be given. -
variables_collections
: Optional collections for the variables. -
outputs_collections
: Collections to add the outputs. -
trainable
: IfTrue
also add variables to the graph collectionGraphKeys.TRAINABLE_VARIABLES
(see tf.Variable). -
data_format
: A string. 'NHWC' and 'NCHW' are supported. -
scope
: Optional scope for variable_scope.
Returns:
A tensor representing the result of adding biases to the inputs.
Raises:
-
ValueError
: Ifdata_format
is neitherNHWC
norNCHW
. -
ValueError
: Ifdata_format
isNCHW
and rank ofinputs
is not 4. -
ValueError
: If the rank ofinputs
is undefined. -
ValueError
: If rank orC
dimension ofinputs
is undefined.
© 2017 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/contrib/layers/bias_add