Class Mask

Inheritance Relationships

Base Type

Class Documentation

class Mask : public mindspore::dataset::TensorTransform

Mask content of the input tensor with the given predicate. Any element of the tensor that matches the predicate will be evaluated to True, otherwise False.

Public Functions

explicit Mask(RelationalOp op, const MSTensor &constant, mindspore::DataType ms_type = mindspore::DataType(mindspore::DataType::kNumberTypeBool))

Constructor.

参数
  • op[in] One of the relational operators: EQ, NE LT, GT, LE or GE.

  • constant[in] Constant to be compared to. It can only be MSTensor of the following types from mindspore::DataType: String, Int, Float, Bool.

  • ms_type[in] Type of the generated mask. It can only be numeric or boolean datatype. (default=mindspore::DataType::kNumberTypeBool)

样例
/* Define operations */
mindspore::MSTensor constant;
auto mask_op = transforms::Mask(RelationalOp::kEqual, constant);

/* dataset is an instance of Dataset object */
dataset = dataset->Map({mask_op},     // operations
                       {"column"});   // input columns
~Mask() = default

Destructor.