Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cle/layers/feedforward.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import ipdb
import numpy as np
import sys
import theano
import theano.tensor as T

from cle.cle.layers import StemCell, InitCell

from itertools import izip
if sys.version_info[0] == 3:
izip = zip
else:
from itertools import izip

from theano.compat.python2x import OrderedDict

Expand Down
6 changes: 5 additions & 1 deletion cle/layers/recurrent.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import ipdb
import numpy as np
import sys
import theano
import theano.tensor as T

from cle.cle.layers import StemCell, InitCell
from cle.cle.utils import tolist
from cle.cle.utils.op import add_noise

from itertools import izip
if sys.version_info[0] == 3:
izip = zip
else:
from itertools import izip

from theano.compat.python2x import OrderedDict

Expand Down
9 changes: 6 additions & 3 deletions cle/train/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import ipdb
import logging
import sys
import theano.tensor as T
import time
if sys.version_info[0] == 3:
izip = zip
else:
from itertools import izip

from cle.cle.graph import TheanoMixin
from cle.cle.models import Model
Expand All @@ -10,8 +15,6 @@
from collections import defaultdict
from theano.compat.python2x import OrderedDict

from itertools import izip


logging.basicConfig(level=logging.INFO, format='%(message)s')
logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -53,7 +56,7 @@ def __init__(self,

t0 = time.time()
self.cost_fn = self.build_training_graph()
print "Elapsed compilation time: %f" % (time.time() - t0)
print("Elapsed compilation time: %f" % (time.time() - t0))
if self.debug_print:
from theano.printing import debugprint
debugprint(self.cost_fn)
Expand Down
2 changes: 1 addition & 1 deletion cle/train/ext.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ipdb
import cPickle
from six.moves import cPickle
import logging
import numpy as np
import os
Expand Down
12 changes: 6 additions & 6 deletions cle/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import ipdb
import cPickle
import logging
import numpy as np
import os
Expand All @@ -11,6 +10,7 @@

from collections import deque
from numpy.lib.stride_tricks import as_strided
from six.moves import cPickle
from theano.compat.python2x import OrderedDict


Expand Down Expand Up @@ -337,10 +337,10 @@ def segment_axis(a, length, overlap=0, axis=None, end='cut', endvalue=0):
l = a.shape[axis]

if overlap>=length:
raise ValueError, "frames cannot overlap by more than 100%"
raise ValueError("frames cannot overlap by more than 100%")
if overlap<0 or length<=0:
raise ValueError, "overlap must be nonnegative and length must be "\
"positive"
raise ValueError("overlap must be nonnegative and length must be "
"positive")

if l<length or (l-length)%(length-overlap):
if l>length:
Expand Down Expand Up @@ -374,8 +374,8 @@ def segment_axis(a, length, overlap=0, axis=None, end='cut', endvalue=0):

l = a.shape[axis]
if l==0:
raise ValueError, "Not enough data points to segment array in 'cut' "\
"mode; try 'pad' or 'wrap'"
raise ValueError("Not enough data points to segment array in 'cut' "
"mode; try 'pad' or 'wrap'")
assert l>=length
assert (l-length)%(length-overlap) == 0
n = 1+(l-length)//(length-overlap)
Expand Down