Ejemplo n.º 1
0
import theano.tensor as T
import numpy
from DL.models.MLP import MLP
from DL.optimizers import optimize
from DL import datasets
from DL.utils import *
import time
# from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams

# hide warnings
import warnings
warnings.simplefilter("ignore")

print "An MLP with dropout on MNIST."
print "loading MNIST"
mnist = datasets.mnist()

print "loading data to the GPU"
dataset = load_data(mnist)

print "creating the MLP"
x = T.matrix('x')  # input
t = T.vector('t')  # targets
inputs = [x, t]
# cast to an int. needs to be initially a float to load to the GPU
it = t.astype('int64')

rng = numpy.random.RandomState(int(time.time()))  # random number generator
# srng = RandomStreams(int(time.time()))
srng = T.shared_randomstreams.RandomStreams(int(time.time()))
Ejemplo n.º 2
0
import theano.tensor as T
import numpy
from DL.models.MLP import MLP
from DL.optimizers import optimize
from DL import datasets
from DL.utils import *
import time

# hide warnings
import warnings
warnings.simplefilter("ignore")


print "An MLP on MNIST."
print "loading MNIST"
mnist = datasets.mnist()

print "loading data to the GPU"
dataset = load_data(mnist)

print "creating the MLP"
x = T.matrix('x')  # input
t = T.vector('t')  # targets
inputs = [x, t]
# cast to an int. needs to be initially a float to load to the GPU
it = t.astype('int64')

rng = numpy.random.RandomState(int(time.time())) # random number generator

# construct the MLP class
mlp = MLP(