Criterion
The Criterion is an abstract class which declares methods defined in all criterions. Like most things in torch, this class is serializable.
[output] forward(input, target)
Given an input
and a target
, compute the loss function associated to the criterion and return the
result. In general input
and target
are tensors, but some specific criterions
might require some other type of object.
The output
returned should be a scalar in general.
The state variable self.output should be updated after a call to forward()
.
[gradInput] backward(input, target)
Given an input
and a target
, compute the gradients of the loss function associated to the criterion and
return the result.In general input
, target
and gradInput
are tensors, but some specific criterions
might require some other type of object.
The state variable self.gradInput should be updated after a call to backward()
.
State variable: output
State variable which contains the result of the last forward(input, target) call.
State variable: gradInput
State variable which contains the result of the last backward(input, target) call.