neuralop.losses.H1Loss

class neuralop.losses.H1Loss(d=1, L=6.283185307179586, reduce_dims=0, reductions='sum', fix_x_bnd=False, fix_y_bnd=False, fix_z_bnd=False)[source]

H1Loss provides the H1 Sobolev norm between two d-dimensional discretized functions

Attributes:
name

Methods

__call__(y_pred, y[, h])

abs(x, y[, h])

absolute H1 norm

compute_terms(x, y, h)

compute_terms computes the necessary finite-difference derivative terms for computing the H1 norm

reduce_all(x)

reduce x across all dimensions in self.reduce_dims according to self.reductions

rel(x, y[, h])

relative H1-norm

uniform_h(x)

uniform_h creates default normalization constants if none already exist.

compute_terms(x, y, h)[source]

compute_terms computes the necessary finite-difference derivative terms for computing the H1 norm

Parameters:
xtorch.Tensor

inputs

ytorch.Tensor

targets

hint or list

discretization size (single or per dim)

Returns:
_type_

_description_

uniform_h(x)[source]

uniform_h creates default normalization constants if none already exist.

Parameters:
xtorch.Tensor

input data

Returns:
hlist

list of normalization constants per-dim

reduce_all(x)[source]

reduce x across all dimensions in self.reduce_dims according to self.reductions

abs(x, y, h=None)[source]

absolute H1 norm

Parameters:
xtorch.Tensor

inputs

ytorch.Tensor

targets

hfloat or list, optional

normalization constant for reduction, by default None

rel(x, y, h=None)[source]

relative H1-norm

Parameters:
xtorch.Tensor

inputs

ytorch.Tensor

targets

hfloat or list, optional

normalization constant for reduction, by default None