Author: João Victor Tozatti Risso
Date of Submission: 2017-08-28
Organization: Python Software Foundation
Suborganization: Theano
#include <malloc.h> | |
#include "filapri.h" | |
static inline int pri_menor(filapri f, size_t ind_a, size_t ind_b); | |
static inline void troca_nodo(filapri f, size_t ind_a, size_t ind_b); | |
static void arruma_heap_up(filapri f); | |
static void arruma_heap_down(filapri f, size_t k); | |
int pri_menor(filapri f, size_t ind_a, size_t ind_b) | |
{ |
import logging, theano | |
logging.basicConfig(format="%(asctime)s:%(levelname)s:%(name)s: %(message)s") | |
theano.disable_log_handler() | |
theano.theano_logger.warning("foo") # Usually it's a library function that does this. |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
#include <string.h> | |
#include <cuda_runtime.h> | |
#include "ctc.h" | |
#define CTC_CHECK(expr) abort_on_error((expr), __LINE__, __func__) | |
#define CUDA_CHECK(expr) cuda_abort_on_error((expr), __LINE__, __func__) |
====================================================================== | |
ERROR: theano.gpuarray.tests.test_dnn.test_dnn_spatialtf_grad | |
---------------------------------------------------------------------- | |
Traceback (most recent call last): | |
File "/home/jvtr/miniconda3/lib/python3.6/site-packages/nose/case.py", line 197, in runTest | |
self.test(*self.arg) | |
File "/home/jvtr/repos/Theano/theano/gpuarray/tests/test_dnn.py", line 2527, in test_dnn_spatialtf_grad | |
utt.verify_grad(functor_wrt_i, [img]) | |
File "/home/jvtr/repos/Theano/theano/tests/unittest_tools.py", line 91, in verify_grad | |
T.verify_grad(op, pt, n_tests, rng, *args, **kwargs) |
import numpy as np | |
import theano | |
import theano.printing | |
import theano.tensor as T | |
from theano.tests import unittest_tools as utt | |
from theano.tensor.nnet.abstract_spatialtf import (AbstractSpatialTransformerGradIOp, AbstractSpatialTransformerGradTOp) | |
from theano.tensor.nnet.spatialtf import (spatialtf, spatialtf_cpu) | |
from theano.gpuarray import dnn | |
from theano.compile.debugmode import DebugMode |
import numpy as np | |
from scipy.stats import mode | |
from scipy.spatial import KDTree | |
class KNearestNeighbors(object): | |
def __init__(self, k=1): | |
assert k >= 1 | |
self.__k = int(k) |
from sklearn.datasets import load_digits | |
import matplotlib.pyplot as plt | |
# Load data set and corresponding labels | |
digits_data = load_digits() | |
digits = digits_data.data | |
labels = digits_data.target | |
class_names = digits_data.target_names | |
# Partition data set into training and test data sets |
classifier = KNearestNeighbors(k=5) | |
# Train the classifier | |
classifier.fit(train_data, train_data_labels) | |
# Obtain the predictions based on the training data | |
prediction = classifier.predict(test_data) |
from sklearn.metrics import confusion_matrix | |
cnf_matrix = confusion_matrix(test_data_labels, prediction) |