def autotune(self, I, F, O):

        start, stop = self.lib.get_events()

        # Only need to do warmup once
        if not self.lib.warmup:
            self.lib.warmup = True
            self.init(self.params, autotune=1, filter_extern=1)
            self.bind_params(I, F, O, alpha=1.0, beta=0.0, bsum=None, flags=1)
            self.execute(repeat=self.warmup, unbind=False)

        results = []
        for external in (0,1):

            self.init(self.params, autotune=1, filter_extern=external)
            self.bind_params(I, F, O, alpha=1.0, beta=0.0, bsum=None, flags=1)
            start.record(stream=self.lib.stream)
            self.execute(repeat=self.warmup, unbind=False)
            stop.record(stream=self.lib.stream)
            stop.synchronize()
            msecs = self.warmup / stop.time_since(start)

            results.append((msecs, external))

        results.sort()
        external = results[0][1]
        # print self.autotune_key
        # for res in results:
        #     print res

        autotune_db = shelve.open(self.autotune_db_file)
        autotune_db[self.autotune_key] = external
        autotune_db.close()

        self.init(self.params, autotune=0, filter_extern=external)
dataset/ETHPy150Open NervanaSystems/neon/neon/backends/winograd_conv.py/XpropWinograd.autotune/swapped operands of `/`