tfmri.math.indicator_box

indicator_box(x, lower_bound=- 1.0, upper_bound=1.0, name=None)[source]

Indicator function of a box.

Returns 0 if x is in the box, inf otherwise.

The box of radius \(r\) is defined as the set of points of \({R}^{n}\) whose components are within the range \([l, u]\).

\[\mathcal{C} = \left\{x \in \mathbb{R}^{n} : l \leq x_i \leq u, \forall i = 1, \dots, n \right\}\]
Parameters
  • x – A tf.Tensor of shape [..., n].

  • lower_bound

    A scalar tf.Tensor. The lower bound of the box. Defaults to -1.

  • upper_bound

    A scalar tf.Tensor. The upper bound of the box. 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.