@tf.function
def mse_loss(static, moving):
    'Computes the mean squared error (MSE) loss.\n\n    Currently, only 4-D inputs are supported.\n\n    Parameters\n    ----------\n    static : tf.Tensor, shape (N, H, W, C)\n        The static image to which the moving image is aligned.\n    moving : tf.Tensor, shape (N, H, W, C)\n        The moving image, the same shape as the static image.\n\n    Returns\n    -------\n    loss : tf.Tensor, shape ()\n        Mean squared error between the static and the moving images,\n        averaged over the batch.\n    '
    loss = tf.reduce_mean(tf.square((moving - static)))
    return loss
Computes the mean squared error (MSE) loss.

Currently, only 4-D inputs are supported.

Parameters
----------
static : tf.Tensor, shape (N, H, W, C)
    The static image to which the moving image is aligned.
moving : tf.Tensor, shape (N, H, W, C)
    The moving image, the same shape as the static image.

Returns
-------
loss : tf.Tensor, shape ()
    Mean squared error between the static and the moving images,
    averaged over the batch.
@tf.function
def mse_loss(static, moving):
    'Computes the mean squared error (MSE) loss.\n\n    Currently, only 4-D inputs are supported.\n\n    Parameters\n    ----------\n    static : tf.Tensor, shape (N, H, W, C)\n        The static image to which the moving image is aligned.\n    moving : tf.Tensor, shape (N, H, W, C)\n        The moving image, the same shape as the static image.\n\n    Returns\n    -------\n    loss : tf.Tensor, shape ()\n        Mean squared error between the static and the moving images,\n        averaged over the batch.\n    '
    loss = tf.reduce_mean(tf.square((moving - static)))
    return loss