Пример #1
0
    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')
Пример #2
0
    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')
Пример #3
0
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)
Пример #4
0
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)
Пример #5
0
 def output_type(self):
     self._assert_can_compare()
     return rules.shape_like_args(self.args, 'boolean')
Пример #6
0
 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')
Пример #7
0
    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')
Пример #8
0
 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)
Пример #9
0
 def output_type(self):
     self._assert_can_compare()
     return rules.shape_like_args(self.args, 'boolean')
Пример #10
0
 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')
Пример #11
0
    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')
Пример #12
0
 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)