class All(ValueOp): input_type = [rules.array(boolean)] _reduction = True def output_type(self): return ir.BooleanScalar def negate(self): return NotAll(self.args[0])
class Any(ValueOp): # Depending on the kind of input boolean array, the result might either be # array-like (an existence-type predicate) or scalar (a reduction) input_type = [rules.array(boolean)] @property def _reduction(self): roots = self.args[0]._root_tables() return len(roots) < 2 def output_type(self): return ir.BooleanScalar if self._reduction else ir.BooleanArray def negate(self): return NotAny(self.args[0])
class FooNode(ops.ValueOp): input_type = [rules.array(dt.int64, name='value')] def output_type(self): return Foo
class MyOp(ops.ValueOp): input_type = [rules.array(dt.double, name='value')] output_type = rules.type_of_arg(0)