TensorPlay
API symbolsnn
Copy
View MarkdownDownload .md

tensorplay.nn.functional.kl_div

tensorplay.nn.functional.kl_div(input: TensorBase, target: TensorBase, size_average=None, reduce=None, reduction: str = 'mean', log_target: bool = False) TensorBase[source]

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'.

Ask DeepWiki