Skip to content

Commit

Permalink
Define reduce() in Python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss authored Sep 30, 2018
1 parent 4e6646a commit 448d7b0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/py2.x/dl/rnn.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#!/usr/bin/env python
# -*- coding: UTF-8 -*-


from __future__ import print_function
import numpy as np
from cnn import element_wise_op
from activators import ReluActivator, IdentityActivator

try:
reduce # Python 2
except NameError: # Python 3
from functools import reduce


class RecurrentLayer(object):
'''
Expand Down Expand Up @@ -154,4 +158,4 @@ def test():
l.forward(x[0])
l.forward(x[1])
l.backward(d, ReluActivator())
return l
return l

0 comments on commit 448d7b0

Please sign in to comment.