Layer that averages a list of inputs. It takes as input a list of tensors, all of the same shape, and returns a single tensor (also of the same shape).
| 306 | |
| 307 | @keras_export('keras.layers.Average') |
| 308 | class Average(_Merge): |
| 309 | """Layer that averages a list of inputs. |
| 310 | |
| 311 | It takes as input a list of tensors, |
| 312 | all of the same shape, and returns |
| 313 | a single tensor (also of the same shape). |
| 314 | """ |
| 315 | |
| 316 | def _merge_function(self, inputs): |
| 317 | output = inputs[0] |
| 318 | for i in range(1, len(inputs)): |
| 319 | output += inputs[i] |
| 320 | return output / len(inputs) |
| 321 | |
| 322 | |
| 323 | @keras_export('keras.layers.Maximum') |