Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Resolved 3 errors - bernoulli, _FlagValues, num_units #362

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
11 changes: 9 additions & 2 deletions seq2seq/contrib/seq2seq/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,15 @@

import six

from tensorflow.contrib.distributions.python.ops import bernoulli
from tensorflow.contrib.distributions.python.ops import categorical
# from tensorflow.contrib.distributions.python.ops import bernoulli
# from tensorflow.contrib.distributions.python.ops import categorical
try:
from tensorflow.python.ops.distributions import bernoulli
from tensorflow.python.ops.distributions import categorical
except:
from tensorflow.contrib.distributions.python.ops import bernoulli
from tensorflow.contrib.distributions.python.ops import categorical

from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.layers import base as layers_base
Expand Down
5 changes: 4 additions & 1 deletion seq2seq/test/pipeline_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
def _clear_flags():
"""Resets Tensorflow's FLAG values"""
#pylint: disable=W0212
tf.app.flags.FLAGS = tf.app.flags._FlagValues()
#tf.app.flags.FLAGS = tf.app.flags._FlagValues()
attr_names = []
for flag_key in dir(tf.app.flags.FLAGS):
delattr(tf.app.flags.FLAGS, flag_key)
tf.app.flags._global_parser = argparse.ArgumentParser()


Expand Down
4 changes: 3 additions & 1 deletion seq2seq/training/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ def cell_from_spec(cell_classname, cell_params):
cell_class = locate(cell_classname) or getattr(rnn_cell, cell_classname)

# Make sure additional arguments are valid
cell_args = set(inspect.getargspec(cell_class.__init__).args[1:])
#cell_args = set(inspect.getargspec(cell_class.__init__).args[1:])
cell_args = set(inspect.signature(cell_class.__init__).parameters)

for key in cell_params.keys():
if key not in cell_args:
raise ValueError(
Expand Down