def output_type(self): all_args = [self.value] options = self.options.op() if isinstance(options, ir.ValueList): all_args += options.values elif isinstance(self.options, ArrayExpr): all_args += [self.options] else: raise TypeError(type(options)) return rules.shape_like_args(all_args, 'boolean')
def _coalesce_upcast(self): # TODO: how much validation is necessary that the call is valid and can # succeed? first_value = self.args[0] if isinstance(first_value, ir.IntegerValue): out_type = 'int64' elif isinstance(first_value, ir.FloatingValue): out_type = 'double' else: out_type = first_value.type() return rules.shape_like_args(self.args, out_type)
def output_type(self): self._assert_can_compare() return rules.shape_like_args(self.args, 'boolean')
def output_type(self): if not util.all_of(self.args, ir.BooleanValue): raise TypeError('Only valid with boolean data') return rules.shape_like_args(self.args, 'boolean')
def output_type(self): if not util.all_of(self.args, ir.NumericValue): raise TypeError('One argument was non-numeric') return rules.shape_like_args(self.args, 'double')
def output_type(self): cases, results, default = self.args out_exprs = results + [default] typename = rules.highest_precedence_type(out_exprs) return rules.shape_like_args(cases, typename)