tfmri.math.indicator_ball

indicator_ball(x, order=2, radius=1.0, name=None)[source]

Indicator function of the Lp ball.

Returns 0 if x is in the Lp ball, inf otherwise.

The \(L_p\) ball of radius \(r\) is defined as the set of points of \({R}^{n}\) whose distance from the origin, as defined by the \(L_p\) norm, is less than or equal to \(r\).

\[\mathcal{B}_r = \left\{x \in \mathbb{R}^{n} : \left\|x\right\|_{p} \leq r \right\}\]

If \(r\) is 1, this ball is also called the unit ball of the :math``L_p`` norm.

Parameters
  • x – A tf.Tensor of shape [..., n].

  • order – A float. The order of the norm. Defaults to 2.

  • radius

    A scalar tf.Tensor. The radius of the ball. Defaults to 1.

  • name – A str. The name of this operation.

Returns

A tf.Tensor of shape [...] and dtype equal to x.dtype.real_dtype.

Raises

ValueError – If inputs are invalid.