iwyoo / convlstmcell-tensorflow Goto Github PK
View Code? Open in Web Editor NEWConvLSTMCell for TensorFlow
License: MIT License
ConvLSTMCell for TensorFlow
License: MIT License
I have some confusions about the code:
_conv(args, output_size, ....) which say shape of inputs is (batch_size x height x width x arg_size) , what's the meaning of "arg_size"?
How to define the input of COnvLSTMCell ? I know how to define a network of LSTM:
X = tf.placeholder([batch_size,time_steps,dim_input])
# [batchsize, time_steps, diminput] => [nsteps, batchsize, dim_input]
X = tf.transpose(X, [1, 0, 2])
# 2. Reshape input to [nsteps*batchsize, dim_input]
X = tf.reshape( X, [-1, dim_input])
# 3. Input layer => Hidden layer
input_split = tf.matmul(X, _W['hidden']) + _b['hidden']
# 4. Splite data to 'nsteps' chunks. An i-th chunck indicates i-th batch data
input_split = tf.split(0,time_steps, input_split)
lstm_cell = tf.nn.rnn_cell.BasicLSTMCell(num_hidden, \
forget_bias=1.0,state_is_tuple=True)
lstm_cell = tf.nn.rnn_cell.MultiRNNCell([lstm_cell]*num_layers,\
state_is_tuple=True)
state = lstm_cell.zero_state(batch_size,dtype=tf.float32)
LSTM_O, LSTM_S = tf.nn.rnn(lstm_cell, input_split, \
initial_state=state)
In the above code ,how to chang the X and input_split to feed to ConvLSTMCell ? (A simple demo which show us how to use would more grateful ! )
Hi,
I got the following error:
Input 'split_dim' of 'Split' Op has type float32 that does not match expected type of int32.
Here is my code: I wish to use convlstm to regress a 14 channel input to a 13 channel output and learn the temporal and spatial information.
x = tf.placeholder(tf.float32, [None, 46, 46, FLAGS.seq_length, 14]) #input is [batch_size, 46,46,10,14], step size is 10, and it is a 14 channel input.
y = tf.placeholder(tf.float32, [None, 46, 46, FLAGS.seq_length, 13])# ground truth data
lr = tf.placeholder("float")
_Hsplit = tf.split(x, FLAGS.seq_length, 3)
_Hsplit = [tf.squeeze(x, [3]) for x in _Hsplit]
cell = ConvLSTMCell(13)
state = cell.zero_state(16, 46, 46) #batchsize is 16, height and width is 46.
x_unwrap = []
with tf.variable_scope("ConvLSTM") as scope: # as BasicLSTMCell
for i, p_input_ in enumerate(_Hsplit):
if i > 0:
scope.reuse_variables()
# ConvCell takes Tensor with size [batch_size, height, width, channel].
t_output, state = cell(p_input_, state)
x_unwrap.append(t_output)
x_unwrap = tf.stack(x_unwrap)
x_unwrap = tf.transpose(x_unwrap, [1, 0, 2, 3, 4])
hidden_unwrap = tf.stack(hidden_unwrap)
hidden_unwrap = tf.transpose(hidden_unwrap, [1, 0, 2, 3, 4])
Thanks for your answer in advance !
ConvLSTMCell-tensorflow/ConvLSTMCell.py
Line 34 in 787388a
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.