It’s a pythonic thing.
A class is a scheme of an object. When you instantiate a class, you are creating an object (an instance) which has specific properties. Constructor is a function called automatically during that process in which you can set up some variables, paramters etcetera…
Once you have that object, which has been defined in the init method, you can call it. By calling, I mean to use it as a function itself.
You could rewrite second funtion as
mse_loss_function = nn.MSELoss()
b= mse_loss_function(output_x, x_labels)
a= cross_entropy_loss_function(output_y, y_labels)
loss = a + b
This does exactly the same than you snippet but following the logical way of coding. You instantiate the class “MSE” and you use the object called mse_loss_function as a function.
But yeh, you are right, init is the constructor which instantiates and when you call the instance it runs forward