MCPcopy
hub / github.com/tensorflow/tfjs / binaryCrossentropy

Function binaryCrossentropy

tfjs-layers/src/losses.ts:193–200  ·  view source on GitHub ↗
(yTrue: Tensor, yPred: Tensor)

Source from the content-addressed store, hash-verified

191}
192
193export function binaryCrossentropy(yTrue: Tensor, yPred: Tensor): Tensor {
194 return tidy(() => {
195 let y: Tensor;
196 y = tfc.clipByValue(yPred, epsilon(), 1 - epsilon());
197 y = tfc.log(tfc.div(y, tfc.sub(1, y)));
198 return tfc.mean(sigmoidCrossEntropyWithLogits(yTrue, y), -1);
199 });
200}
201
202export function kullbackLeiblerDivergence(
203 yTrue: Tensor, yPred: Tensor): Tensor {

Callers

nothing calls this directly

Calls 8

tidyFunction · 0.90
epsilonFunction · 0.90
clipByValueMethod · 0.80
divMethod · 0.80
subMethod · 0.80
meanMethod · 0.80
logMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…