tf.nn.bias_add
Stay organized with collections
Save and categorize content based on your preferences.
Adds bias
to value
.
tf.nn.bias_add(
value, bias, data_format=None, name=None
)
Used in the notebooks
Used in the guide |
Used in the tutorials |
|
|
This is (mostly) a special case of tf.add
where bias
is restricted to 1-D.
Broadcasting is supported, so value
may have any number of dimensions.
Unlike tf.add
, the type of bias
is allowed to differ from value
in the
case where both types are quantized.
Args |
value
|
A Tensor with type float , double , int64 , int32 , uint8 ,
int16 , int8 , complex64 , or complex128 .
|
bias
|
A 1-D Tensor with size matching the channel dimension of value .
Must be the same type as value unless value is a quantized type,
in which case a different quantized type may be used.
|
data_format
|
A string. 'N...C' and 'NC...' are supported. If None (the
default) is specified then 'N..C' is assumed.
|
name
|
A name for the operation (optional).
|
Returns |
A Tensor with the same type as value .
|
Raises |
ValueError if data format is unrecognized, if value has less than two
dimensions when data_format is 'N..C'/None or value has less
then three dimensions when data_format is NC.. , if bias does not
have exactly one dimension (is a vector), or if the size of bias
does not match the size of the channel dimension of value .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-04-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-26 UTC."],[],[],null,["# tf.nn.bias_add\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.16.1/tensorflow/python/ops/nn_ops.py#L3516-L3560) |\n\nAdds `bias` to `value`.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.nn.bias_add`](https://www.tensorflow.org/api_docs/python/tf/nn/bias_add)\n\n\u003cbr /\u003e\n\n tf.nn.bias_add(\n value, bias, data_format=None, name=None\n )\n\n### Used in the notebooks\n\n| Used in the guide | Used in the tutorials |\n|-----------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|\n| - [Use TF1.x models in TF2 workflows](https://www.tensorflow.org/guide/migrate/model_mapping) | - [Scalable model compression](https://www.tensorflow.org/tutorials/optimization/compression) |\n\nThis is (mostly) a special case of [`tf.add`](../../tf/math/add) where `bias` is restricted to 1-D.\nBroadcasting is supported, so `value` may have any number of dimensions.\nUnlike [`tf.add`](../../tf/math/add), the type of `bias` is allowed to differ from `value` in the\ncase where both types are quantized.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `value` | A `Tensor` with type `float`, `double`, `int64`, `int32`, `uint8`, `int16`, `int8`, `complex64`, or `complex128`. |\n| `bias` | A 1-D `Tensor` with size matching the channel dimension of `value`. Must be the same type as `value` unless `value` is a quantized type, in which case a different quantized type may be used. |\n| `data_format` | A string. 'N...C' and 'NC...' are supported. If `None` (the default) is specified then 'N..C' is assumed. |\n| `name` | A name for the operation (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `Tensor` with the same type as `value`. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|---|---|\n| ValueError if data format is unrecognized, if `value` has less than two dimensions when `data_format` is 'N..C'/`None` or `value` has less then three dimensions when `data_format` is `NC..`, if `bias` does not have exactly one dimension (is a vector), or if the size of `bias` does not match the size of the channel dimension of `value`. ||\n\n\u003cbr /\u003e"]]