f4503bb3a3be014b452f54d8e2d187bb6419f627,autokeras/classifier.py,ImageClassifier,predict,#ImageClassifier#Any#,216

Before Change


        Returns:
            An numpy.ndarray containing the results.
        
        if constant.LIMIT_MEMORY:
            config = tf.ConfigProto()
            config.gpu_options.allow_growth = True
            sess = tf.Session(config=config)
            init = tf.global_variables_initializer()
            sess.run(init)
            backend.set_session(sess)
        x_test = x_test.astype("float32") / 255
        model = self.load_searcher().load_best_model().produce_model()
        return self.y_encoder.inverse_transform(model.predict(x_test, ))

After Change


        model = self.load_searcher().load_best_model().produce_model()
        model.eval()

        outputs = []
        with torch.no_grad():
            for index, inputs in enumerate(test_loader):
                outputs.append(model(inputs).numpy())
        output = reduce(lambda x, y: np.concatenate((x, y)), outputs)
        return self.y_encoder.inverse_transform(output)

    def evaluate(self, x_test, y_test):
        Return the accuracy score between predict value and test_y.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 5

Instances


Project Name: jhfjhfj1/autokeras
Commit Name: f4503bb3a3be014b452f54d8e2d187bb6419f627
Time: 2018-08-01
Author: jhfjhfj1@gmail.com
File Name: autokeras/classifier.py
Class Name: ImageClassifier
Method Name: predict


Project Name: wenwei202/iss-rnns
Commit Name: 535d15402492fc10579a3211dc83c74f2741cc31
Time: 2016-10-23
Author: seominjoon@gmail.com
File Name: my/tensorflow/general.py
Class Name:
Method Name: flatten


Project Name: biolab/orange3
Commit Name: 04d9602bdc6e1af0106356e090b69be37a5c7ee9
Time: 2019-10-21
Author: janez.demsar@fri.uni-lj.si
File Name: Orange/widgets/visualize/owdistributions.py
Class Name: OWDistributions
Method Name: _set_bin_width_slider_label