def expected_input_types(self, arg_types): max_nbytes = max(t.nbytes for t in arg_types) if max_nbytes <= 4: upcast_types = [Float32.combine(t) for t in arg_types] else: upcast_types = [Float64.combine(t) for t in arg_types] return Prim.expected_input_types(self, upcast_types)
def expected_input_types(self, arg_types): assert all(isinstance(t, ScalarT) for t in arg_types), \ "Prim %s expects scalar inputs but given %s" % (self, arg_types) max_nbytes = max(t.nbytes for t in arg_types) if max_nbytes <= 4: upcast_types = [Float32.combine(t) for t in arg_types] else: upcast_types = [Float64.combine(t) for t in arg_types] return Prim.expected_input_types(self, upcast_types)