# tensorflow::ops::FusedBatchNormGrad

`#include <nn_ops.h>`

Gradient for batch normalization.

## Summary

Note that the size of 4D Tensors are defined by either "NHWC" or "NCHW". The size of 1D Tensors matches the dimension C of the 4D Tensors.

Args:

- scope: A [Scope](https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object
- y_backprop: A 4D [Tensor](https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) for the gradient with respect to y.
- x: A 4D [Tensor](https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) for input data.
- scale: A 1D [Tensor](https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) for scaling factor, to scale the normalized x.
- reserve_space_1: When is_training is True, a 1D [Tensor](https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) for the computed batch mean to be reused in gradient computation. When is_training is False, a 1D [Tensor](https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) for the population mean to be reused in both 1st and 2nd order gradient computation.
- reserve_space_2: When is_training is True, a 1D [Tensor](https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) for the computed batch variance (inverted variance in the cuDNN case) to be reused in gradient computation. When is_training is False, a 1D [Tensor](https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) for the population variance to be reused in both 1st and 2nd order gradient computation.

<br />

Optional attributes (see `https://www.tensorflow.org/versions/r2.12/api_docs/cc/struct/tensorflow/ops/fused-batch-norm-grad/attrs#structtensorflow_1_1ops_1_1_fused_batch_norm_grad_1_1_attrs`):

- epsilon: A small float number added to the variance of x.
- data_format: The data format for y_backprop, x, x_backprop. Either "NHWC" (default) or "NCHW".
- is_training: A bool value to indicate the operation is for training (default) or inference.

<br />

Returns:

- `https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output` x_backprop: A 4D [Tensor](https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) for the gradient with respect to x.
- `https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output` scale_backprop: A 1D [Tensor](https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) for the gradient with respect to scale.
- `https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output` offset_backprop: A 1D [Tensor](https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) for the gradient with respect to offset.
- `https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output` reserve_space_3: Unused placeholder to match the mean input in [FusedBatchNorm](https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/ops/fused-batch-norm#classtensorflow_1_1ops_1_1_fused_batch_norm).
- `https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output` reserve_space_4: Unused placeholder to match the variance input in [FusedBatchNorm](https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/ops/fused-batch-norm#classtensorflow_1_1ops_1_1_fused_batch_norm).

<br />

| ### Constructors and Destructors ||
|---|---|
| `https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/ops/fused-batch-norm-grad#classtensorflow_1_1ops_1_1_fused_batch_norm_grad_1a29e7af89304668b72f3a9741d9135446(const ::https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, ::https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input y_backprop, ::https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input x, ::https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input scale, ::https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input reserve_space_1, ::https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input reserve_space_2)` ||
| `https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/ops/fused-batch-norm-grad#classtensorflow_1_1ops_1_1_fused_batch_norm_grad_1ad28cd25e098ff0c4950e5442700525bd(const ::https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, ::https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input y_backprop, ::https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input x, ::https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input scale, ::https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input reserve_space_1, ::https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input reserve_space_2, const https://www.tensorflow.org/versions/r2.12/api_docs/cc/struct/tensorflow/ops/fused-batch-norm-grad/attrs#structtensorflow_1_1ops_1_1_fused_batch_norm_grad_1_1_attrs & attrs)` ||

| ### Public attributes ||
|---|---|
| `https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/ops/fused-batch-norm-grad#classtensorflow_1_1ops_1_1_fused_batch_norm_grad_1af810889b9fc9d4834fa2ebae7f82cd9d` | `::https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output` |
| `https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/ops/fused-batch-norm-grad#classtensorflow_1_1ops_1_1_fused_batch_norm_grad_1a3bab3f206d975bbe4f6ee0dee56067dd` | `https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation` |
| `https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/ops/fused-batch-norm-grad#classtensorflow_1_1ops_1_1_fused_batch_norm_grad_1a33ba927a145b4dfcd0a4b8b35184b86c` | `::https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output` |
| `https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/ops/fused-batch-norm-grad#classtensorflow_1_1ops_1_1_fused_batch_norm_grad_1a09b361117c6b374e8a07c97bdbbdbcee` | `::https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output` |
| `https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/ops/fused-batch-norm-grad#classtensorflow_1_1ops_1_1_fused_batch_norm_grad_1a4eaeefc4f041fba23d1746e7ed7b54ff` | `::https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output` |
| `https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/ops/fused-batch-norm-grad#classtensorflow_1_1ops_1_1_fused_batch_norm_grad_1a916a436e2db5bd8db1227d2a3c979c8e` | `::https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output` |

| ### Public static functions ||
|---|---|
| `https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/ops/fused-batch-norm-grad#classtensorflow_1_1ops_1_1_fused_batch_norm_grad_1a0bd2ab8db87dc5f730bd45daefcdbcaf(StringPiece x)` | `https://www.tensorflow.org/versions/r2.12/api_docs/cc/struct/tensorflow/ops/fused-batch-norm-grad/attrs#structtensorflow_1_1ops_1_1_fused_batch_norm_grad_1_1_attrs` |
| `https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/ops/fused-batch-norm-grad#classtensorflow_1_1ops_1_1_fused_batch_norm_grad_1ac58037cdbac7b7a90522cf6bd4c524ee(float x)` | `https://www.tensorflow.org/versions/r2.12/api_docs/cc/struct/tensorflow/ops/fused-batch-norm-grad/attrs#structtensorflow_1_1ops_1_1_fused_batch_norm_grad_1_1_attrs` |
| `https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/ops/fused-batch-norm-grad#classtensorflow_1_1ops_1_1_fused_batch_norm_grad_1a94d0078f0786e17f4d9f9c188f86ca1a(bool x)` | `https://www.tensorflow.org/versions/r2.12/api_docs/cc/struct/tensorflow/ops/fused-batch-norm-grad/attrs#structtensorflow_1_1ops_1_1_fused_batch_norm_grad_1_1_attrs` |

| ### Structs ||
|---|---|
| [tensorflow::ops::FusedBatchNormGrad::Attrs](https://www.tensorflow.org/versions/r2.12/api_docs/cc/struct/tensorflow/ops/fused-batch-norm-grad/attrs) | Optional attribute setters for [FusedBatchNormGrad](https://www.tensorflow.org/versions/r2.12/api_docs/cc/class/tensorflow/ops/fused-batch-norm-grad#classtensorflow_1_1ops_1_1_fused_batch_norm_grad). |

## Public attributes

### offset_backprop

```
::tensorflow::Output offset_backprop
```

### operation

```
Operation operation
```

### reserve_space_3

```
::tensorflow::Output reserve_space_3
```

### reserve_space_4

```
::tensorflow::Output reserve_space_4
```

### scale_backprop

```
::tensorflow::Output scale_backprop
```

### x_backprop

```
::tensorflow::Output x_backprop
```

## Public functions

### FusedBatchNormGrad

```
 FusedBatchNormGrad(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input y_backprop,
  ::tensorflow::Input x,
  ::tensorflow::Input scale,
  ::tensorflow::Input reserve_space_1,
  ::tensorflow::Input reserve_space_2
)
```

### FusedBatchNormGrad

```
 FusedBatchNormGrad(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input y_backprop,
  ::tensorflow::Input x,
  ::tensorflow::Input scale,
  ::tensorflow::Input reserve_space_1,
  ::tensorflow::Input reserve_space_2,
  const FusedBatchNormGrad::Attrs & attrs
)
```

## Public static functions

### DataFormat

```
Attrs DataFormat(
  StringPiece x
)
```

### Epsilon

```
Attrs Epsilon(
  float x
)
```

### IsTraining

```
Attrs IsTraining(
  bool x
)
```