From 3ebc3edfff5ec31af52a216bd312da360c2b0615 Mon Sep 17 00:00:00 2001 From: Kayyuri Date: Wed, 3 Dec 2025 11:47:33 +0530 Subject: [PATCH 1/2] Modified Dense layer documentation for use_bias with batch normalization Clarified the use of 'use_bias' in the Dense layer documentation to include information about batch normalization. --- keras/src/layers/core/dense.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/keras/src/layers/core/dense.py b/keras/src/layers/core/dense.py index 56c86f50cbf6..07a76a61caad 100644 --- a/keras/src/layers/core/dense.py +++ b/keras/src/layers/core/dense.py @@ -23,7 +23,8 @@ class Dense(Layer): where `activation` is the element-wise activation function passed as the `activation` argument, `kernel` is a weights matrix created by the layer, and `bias` is a bias vector created by the layer - (only applicable if `use_bias` is `True`). + (only applicable if `use_bias` is `True`), we can set use_bias as False if + we add batch_normalization as it has it's own inbuild parameters. Note: If the input to the layer has a rank greater than 2, `Dense` computes the dot product between the `inputs` and the `kernel` along the From 89b5757b8078281b65ec5f22d561895c35876165 Mon Sep 17 00:00:00 2001 From: Kayyuri Date: Wed, 3 Dec 2025 11:54:59 +0530 Subject: [PATCH 2/2] Update keras/src/layers/core/dense.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- keras/src/layers/core/dense.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/keras/src/layers/core/dense.py b/keras/src/layers/core/dense.py index 07a76a61caad..8af0120c5101 100644 --- a/keras/src/layers/core/dense.py +++ b/keras/src/layers/core/dense.py @@ -23,8 +23,9 @@ class Dense(Layer): where `activation` is the element-wise activation function passed as the `activation` argument, `kernel` is a weights matrix created by the layer, and `bias` is a bias vector created by the layer - (only applicable if `use_bias` is `True`), we can set use_bias as False if - we add batch_normalization as it has it's own inbuild parameters. + (only applicable if `use_bias` is `True`). When this layer is + followed by a `BatchNormalization` layer, it is recommended to set + `use_bias=False` as `BatchNormalization` has its own bias term. Note: If the input to the layer has a rank greater than 2, `Dense` computes the dot product between the `inputs` and the `kernel` along the