(x: Tensor,
            dx: Tensor or float = 1,
            padding: Extrapolation = extrapolation.BOUNDARY,
            dims: tuple or None = None)
return result
Spatial Laplace operator as defined for scalar fields.
    If a vector field is passed, the laplace is computed component-wise.

    Args:
        x: n-dimensional field of shape (batch, spacial dimensions..., components)
        dx: scalar or 1d tensor
        padding: extrapolation
        dims: The second derivative along these dimensions is summed over

    Returns:
        `phi.math.Tensor` of same shape as `x`
Spatial Laplace operator as defined for scalar fields.
    If a vector field is passed, the laplace is computed component-wise.
Spatial Laplace operator as defined for scalar fields . If a vector field is passed the laplace is computed component - wise .
def laplace(x: Tensor,
            dx: Tensor or float = 1,
            padding: Extrapolation = extrapolation.BOUNDARY,
            dims: tuple or None = None):
    """
    Spatial Laplace operator as defined for scalar fields.
    If a vector field is passed, the laplace is computed component-wise.

    Args:
        x: n-dimensional field of shape (batch, spacial dimensions..., components)
        dx: scalar or 1d tensor
        padding: extrapolation
        dims: The second derivative along these dimensions is summed over

    Returns:
        `phi.math.Tensor` of same shape as `x`

    """
    if isinstance(dx, (tuple, list)):
        dx = wrap(dx, batch('_laplace'))
    elif isinstance(dx, Tensor) and dx.vector.exists:
        dx = math.rename_dims(dx, 'vector', batch('_laplace'))
    if isinstance(x, Extrapolation):
        return x.spatial_gradient()
    left, center, right = shift(wrap(x), (-1, 0, 1), dims, padding, stack_dim=batch('_laplace'))
    result = (left + right - 2 * center) / (dx ** 2)
    result = math.sum_(result, '_laplace')
    return result
def laplace ( x : Tensor , dx : Tensor or float = 1 , padding : Extrapolation = extrapolation . BOUNDARY , dims : tuple or None = None ) : if isinstance ( dx , ( tuple , list ) ) : dx = wrap ( dx , batch ( '_laplace' ) ) elif isinstance ( dx , Tensor ) and dx . vector . exists : dx = math . rename_dims ( dx , 'vector' , batch ( '_laplace' ) ) if isinstance ( x , Extrapolation ) : return x . spatial_gradient ( ) left , center , right = shift ( wrap ( x ) , ( - 1 , 0 , 1 ) , dims , padding , stack_dim = batch ( '_laplace' ) ) result = ( left + right - 2 * center ) / ( dx ** 2 ) result = math . sum_ ( result , '_laplace' ) return result