# tensorplay.nn.functional.kl_div

Source: https://www.tensorplay.cn/docs/generated/tensorplay.nn.functional.kl_div.html

# tensorplay.nn.functional.kl_div

tensorplay.nn.functional.kl_div(input: TensorBase, target: TensorBase, size_average=None, reduce=None, reduction: [str](https://docs.python.org/3/library/stdtypes.html#str) = 'mean', log_target: [bool](https://docs.python.org/3/library/functions.html#bool) = False) &#x2192; TensorBase[[source]](../_modules/tensorplay/nn/functional.html#kl_div)

Compute the KL Divergence loss.

input holds log-probabilities; see KLDivLoss.
Note that reduction='mean' divides by the number of elements and
does not return the true KL divergence value — use 'batchmean'.
