Super simple question: since lambda > 0 [because of the log(lambda_hat)] how could I go about defining the loss function to guarantee proper lambdas? In principle implementing it with pytorch functions is straightforward:
def poissonLoss(predicted, observed):
    """Custom loss function for Poisson model."""
    loss=torch.mean(predicted-observed*torch.log(predicted))
    return loss

But I obviously need to force the output to be strictly positive otherwise I’ll get -inf and nans. What sort of correction for the last layer could I use? Like ReLU with a floor>0 of sorts?