Nested Classes
class | BooleanMaskUpdate.Options | Optional attributes for BooleanMaskUpdate
|
Public Constructors
Public Methods
static BooleanMaskUpdate.Options |
axis(Integer axis)
Used to indicate the axis to mask from.
|
static BooleanMaskUpdate.Options |
broadcast(Boolean broadcast)
Whether to try broadcasting update.
|
static <T extends TType> Operand<T> |
Inherited Methods
Public Constructors
public BooleanMaskUpdate ()
Public Methods
public static BooleanMaskUpdate.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 BooleanMaskUpdate.Options broadcast (Boolean broadcast)
Whether to try broadcasting update. True by default.
public static Operand<T> create (Scope scope, Operand<T> tensor, Operand<TBool> mask, Operand<T> updates, Options... options)
Updates a tensor at the masked values, and returns the updated tensor. Does not mutate the input tensors. updates
will be broadcasted by default
Numpy equivalent is `tensor[mask] = updates`.
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.
The shape of updates
should be [n, t_1, t_2, ...]
where n
is the number of true values in
mask
and t_i
is the i
th dimension of tensor
after axis
and mask
.
updates
will be broadcasted to this shape by default, which can be disabled using options
.
Parameters
tensor | The tensor to mask. |
---|---|
mask | The mask to apply. |
updates | the new values |
options | carries optional attributes values |
Returns
- The masked tensor.