BooleanMask

public abstract class BooleanMask

Nested Classes

class BooleanMask.Options Optional attributes for BooleanMask  

Public Constructors

Public Methods

static BooleanMask.Options
axis(Integer axis)
Used to indicate the axis to mask from.
static BooleanMask.Options
axis(int axis)
Used to indicate the axis to mask from.
static <T extends TType> Operand<T>
create(Scope scope, Operand<T> tensor, Operand<TBool> mask, Options... options)
Apply boolean mask to tensor.

Inherited Methods

Public Constructors

public BooleanMask ()

Public Methods

public static BooleanMask.Options axis (Integer axis)

Used to indicate the axis to mask from. axis + dim(mask) <= dim(tensor) and mask's shape must match the first axis + dim(mask) dimensions of tensor's shape.

Parameters
axis the axis to mask from. Uses 0 if null.

public static BooleanMask.Options axis (int axis)

Used to indicate the axis to mask from. axis + dim(mask) <= dim(tensor) and mask's shape must match the first axis + dim(mask) dimensions of tensor's shape.

Parameters
axis the axis to mask from.

public static Operand<T> create (Scope scope, Operand<T> tensor, Operand<TBool> mask, Options... options)

Apply boolean mask to tensor. Returns the flat array of each element corresponding to a true in the mask.

Numpy equivalent is tensor[mask].

In general, 0 < dim(mask) = K <= dim(tensor), and mask's shape must match the first K dimensions of tensor's shape. We then have: booleanMask(tensor, mask)[i, j1,...,jd] = tensor[i1,...,iK,j1,...,jd] where (i1,...,iK) is the ith true entry of mask (row-major order).

The axis could be used with mask to indicate the axis to mask from (it's 0 by default). In that case, axis + dim(mask) <= dim(tensor) and mask's shape must match the first axis + dim(mask) dimensions of tensor's shape.

Parameters
tensor The tensor to mask.
mask The mask to apply.
options carries optional attributes values
Returns
  • The masked tensor.