Computes mean and std for batch then apply batch_normalization on batch. Arguments: x: Input tensor or variable. gamma: Tensor by which to scale the input. beta: Tensor with which to center the input. reduction_axes: iterable of integers, axes over which to norma
(x, gamma, beta, reduction_axes, epsilon=1e-3)
| 2469 | |
| 2470 | @keras_export('keras.backend.normalize_batch_in_training') |
| 2471 | def normalize_batch_in_training(x, gamma, beta, reduction_axes, epsilon=1e-3): |
| 2472 | """Computes mean and std for batch then apply batch_normalization on batch. |
| 2473 | |
| 2474 | Arguments: |
| 2475 | x: Input tensor or variable. |
| 2476 | gamma: Tensor by which to scale the input. |
| 2477 | beta: Tensor with which to center the input. |
| 2478 | reduction_axes: iterable of integers, |
| 2479 | axes over which to normalize. |
| 2480 | epsilon: Fuzz factor. |
| 2481 | |
| 2482 | Returns: |
| 2483 | A tuple length of 3, `(normalized_tensor, mean, variance)`. |
| 2484 | """ |
| 2485 | if ndim(x) == 4 and list(reduction_axes) in [[0, 1, 2], [0, 2, 3]]: |
| 2486 | if not _has_nchw_support() and list(reduction_axes) == [0, 2, 3]: |
| 2487 | return _broadcast_normalize_batch_in_training( |
| 2488 | x, gamma, beta, reduction_axes, epsilon=epsilon) |
| 2489 | return _fused_normalize_batch_in_training( |
| 2490 | x, gamma, beta, reduction_axes, epsilon=epsilon) |
| 2491 | else: |
| 2492 | if sorted(reduction_axes) == list(range(ndim(x)))[:-1]: |
| 2493 | return _regular_normalize_batch_in_training( |
| 2494 | x, gamma, beta, reduction_axes, epsilon=epsilon) |
| 2495 | else: |
| 2496 | return _broadcast_normalize_batch_in_training( |
| 2497 | x, gamma, beta, reduction_axes, epsilon=epsilon) |
| 2498 | |
| 2499 | |
| 2500 | @keras_export('keras.backend.batch_normalization') |
nothing calls this directly
no test coverage detected