Custom loss function has no attribute backward

Putting loss inside the model definition? For example, see Trainable Variable in Loss Function and Matrix Multiplication