tensorflow-seq2seq-autoencoder's People
Forkers
wavelets mperiwal-kore caili5104 dilip-dmk aaron-yin ian-beaver pedrobisp junhaowang kingmv gaelbernardtensorflow-seq2seq-autoencoder's Issues
Incorrect dimensions (leading to misleading performance)
Hi,
In Tensorflow-seq2seq-autoencoder/simple_seq2seq_autoencoder.py
, the code runs and training converges for me, but I think it isn't implementing the LSTM autoencoder properly:
I notice that encoder_inputs is a list of length 1, containing a reference to a Tensorflow tensor object of shape (10,3) = (size (of the hidden layer),frame_dim)
.
help(tf.nn.rnn)
says that input is assumed to be a list of length T, where each element is a reference to a Tensorflow tensor of shape [batch_size x cell.state_size]
.
tf.nn.rnn
may see this as a sequence of length 1, where the batch size is 10 and the frame dimension is 3.
Another approach may involve
encoder_inputs = tf.unpack(seq_input)
Here is a sketch of my attempt to fix this. It has a few other unrelated changes, sorry about that..
# if encoder input is "X, Y, Z", then decoder input is "0, X, Y, Z". Therefore, the decoder size
# and target size equal encoder size plus 1. For simplicity, here I droped the last one.
encoder_inputs_unpacked=tf.unpack(encoder_inputs)
decoder_inputs = ([tf.zeros_like(encoder_inputs_unpacked[0], name="GO")] + encoder_inputs_unpacked[:-1])
targets = desired_outputs
weights = [tf.ones_like(targets_t, dtype=tf.float32) for targets_t in tf.unpack(targets)]
# basic LSTM seq2seq model
cell = tf.nn.rnn_cell.GRUCell(size)
enc_output, enc_state = tf.nn.dynamic_rnn(cell, encoder_inputs, dtype=tf.float32, time_major=True)
enc_state=tf.nn.dropout(keep_prob=0.8,x=enc_state)
enc_state_unpacked=tf.unpack(enc_state,num=n_steps)
if makeHiddenLayerBinary:
enc_state=tf.nn.sigmoid(enc_state)
cell_to_reconstruction = tf.nn.rnn_cell.OutputProjectionWrapper(cell, frame_dim)
dec_outputs, dec_state = tf.nn.seq2seq.rnn_decoder(decoder_inputs, enc_state, cell_to_reconstruction)
# e_stop = np.array([1, 1])
'module' object has no attribute 'rnn'
(tensorflow2.7) itamblyn@laertes:~/tmp/Tensorflow-seq2seq-autoencoder$ python simple_seq2seq_autoencoder.py
Traceback (most recent call last):
File "simple_seq2seq_autoencoder.py", line 37, in
_, enc_state = tf.nn.rnn(cell, encoder_inputs, dtype=tf.float32)
AttributeError: 'module' object has no attribute 'rnn'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.