chainer.functions.sigmoid_cross_entropy¶
-
chainer.functions.
sigmoid_cross_entropy
(x, t, normalize=True, reduce='mean')[source]¶ Computes cross entropy loss for pre-sigmoid activations.
Parameters: - x (Variable) – A variable object holding a matrix whose (i, j)-th element indicates the unnormalized log probability of the j-th unit at the i-th example.
- t (Variable) – Variable holding an int32 vector of ground truth labels.
If
t[i] == -1
, correspondingx[i]
is ignored. Loss is zero if all ground truth labels are-1
. - normalize (bool) – Variable holding a boolean value which determines the normalization constant. If true, this function normalizes the cross entropy loss across all instances. If else, it only normalizes along a batch size.
- reduce (str) – Variable holding a
str
which determines whether to reduce the shape of the input. If it is'mean'
, it computes the sum of cross entropy and normalize it according tonormalize
option. If is is'no'
, this function computes cross entropy for each instance and does not normalize it (normalize
option is ignored). In this case, the loss value of the ignored instance, which has-1
as its target value, is set to0
.
Returns: A variable object holding an array of the cross entropy. If
reduce
is'mean'
, it is a scalar array. Ifreduce
is'no'
, the shape is same asx
.Return type: Note
This function is differentiable only by
x
.