Many thanks. It works but the parameters can’t be updated during backward processing. Maybe there must be something wrong. Actually, I want to write a contrasive loss function. The parameter is margin. Do you have any idea about that?