New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Convolutional LSTM #8891
Added Convolutional LSTM #8891
Conversation
Can one of the admins verify this patch? |
I think that if you want to use the cell with |
No; dynamic_rnn supports tensors with shape 2D+ as input.
…On Mon, Apr 3, 2017 at 3:55 AM, Marco Ciccone ***@***.***> wrote:
I think that if you want to use the cell with dynamic_rnn wrapper, this
would not work because it needs a 3D tensor for the scan. Am I right?
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#8891 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABtimzzSM3oi2wehVGpIT1mQmBzoYUbaks5rsNA4gaJpZM4MwTz9>
.
|
Thanks @ebrevdo, since when it is supported? I'm having an error with my implementation that the shape must be 3D so I'm asking. Do I need to specify any abstract method or something else? I tag @carlthome because I think he's interested too |
The tensorflow nightlies should have this bug fixed.
…On Apr 3, 2017 1:24 PM, "Marco Ciccone" ***@***.***> wrote:
Thanks @ebrevdo <https://github.com/ebrevdo>, since when it is supported?
I'm having an error with my implementation that the shape must be 3D so I'm
asking. Do I need to specify any abstract method or something else?
I tag @carlthome <https://github.com/carlthome> because I think he's
interested too
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8891 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABtim1wXVGdavJIWvCLsI83MMZxSU6uxks5rsVWNgaJpZM4MwTz9>
.
|
It doesn't seem so, here we have a reshape that fails if I have more than 2 dimensions. Am I missing something? I can open an issue in case I'm right |
else: | ||
res = nn_ops.conv2d(array_ops.concat(axis=3, values=args), matrix, strides=[1, 1, 1, 1], padding='SAME') | ||
if not bias: | ||
return res |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's bad style to have multiple returns in the same function.
Rather do if bias: res += bias
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cleaned this up a little bit however the function still has the 2 return statements. The reason I wrote it this way was because the _linear
function written in tensorflow/contrib/rnn/python/ops/core_rnn_cell_impl.py
has 2 return statements. I can definitely change it but it seemed more consistent to do it this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How unfortunate, but consistency 👍
# Parameters of gates are concatenated into one multiply for efficiency. | ||
(c, h) = state | ||
|
||
concat = _conv_linear([inputs, h], self._filter_size, self._num_features * 4, True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If self._num_features
is 1, will the gates be created? I think the minimum should be 4 here, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not believe this is a issue. The gates will still be created. In the tensorflow/contrib/rnn/python/kernel_tests/rnn_cell_test.py test I wrote, the filter size is set to 1 with no issues
|
||
@property | ||
def output_size(self): | ||
return self._shape |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this include self._num_features
?
|
||
@property | ||
def state_size(self): | ||
return core_rnn_cell.LSTMStateTuple(self._shape, self._shape) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this include self._num_features
?
Any update on this review? |
I don't think this works with |
@loliverhennigh Do you plan to come back again on this? |
…o feature/conv_lstm_rnn
…to feature/conv_lstm_rnn
I updated some of the issues mention above |
@carlthome @ebrevdo let us know what the next steps are! |
Hi @loliverhennigh! Thanks for taking the time to sit down and implement this. Have you seen sonnet's ConvLSTM module? They have a very nice API and implementation that is sort-of but not 100% identical to yours. Would you be interested in writing a ConvLSTM matching this API / impl? Note also we've gotten rid of _checked_scope in favor of RNNCell subclassing tf.layers.Layer; so we no longer override call but instead have a "def call(self, inputs, state):" |
friendly ping for @loliverhennigh |
Oh cool, I had not seen sonnet yet. I could definitely rewrite my ConvLstm to match that one. I like that it has support for 1,2, and 3d convs. |
That would be great!
On May 4, 2017 9:12 PM, "Oliver Hennigh" <notifications@github.com> wrote:
Oh cool, I had not seen sonnet yet. I could definitely rewrite my ConvLstm
to match that one. I like that it has support for 1,2, and 3d convs.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8891 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABtim8lvf_7MzpKKjLTzcYEg5UDALT8wks5r2qGugaJpZM4MwTz9>
.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add versions of the same tests where the batch size is not known and you feed the inputs and initial state via feed_dict to session.run? This should ensure the code works for batch size a Tensor.
…o feature/conv_lstm_rnn
Ping for @loliverhennigh on the last comment about adding tests. |
…o feature/conv_lstm_rnn
…o feature/conv_lstm_rnn
…o feature/conv_lstm_rnn
…o feature/conv_lstm_rnn
…o feature/conv_lstm_rnn
I think this fixes the variable batch size problem and also allows for variable image sizes. The kernel tests now reflect this. I think this might be all good now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good to me, thanks! (One could remove the conv_dims or have just 1 class, but the current version looks consistent with our layers, so I don't have any strong opinion on that.)
Jenkins, test this please
…On Aug 5, 2017 12:57 PM, "Lukasz Kaiser" ***@***.***> wrote:
***@***.**** approved this pull request.
The code looks good to me, thanks! (One could remove the conv_dims or have
just 1 class, but the current version looks consistent with our layers, so
I don't have any strong opinion on that.)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8891 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AT_Sbcki11vjQA84KiDDjx0oIr1lBEmsks5sVMkSgaJpZM4MwTz9>
.
|
Jenkins, test this please. |
The Linux build is transient, but there is a windows build error:
|
This is a python only change, I think?
…On Aug 7, 2017 8:10 AM, "drpngx" ***@***.***> wrote:
The Linux build is transient, but there is a windows build error:
08:30:35 4>measuring_cost_estimator.obj : error LNK2019: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl tensorflow::SanitizeThreadSuffix(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" ***@***.***@@***@***.******@***.***@std@@***@***.***@2@@std@@v23@@z) referenced in function "public: __cdecl tensorflow::grappler::MeasuringCostEstimator::MeasuringCostEstimator(class tensorflow::grappler::Cluster *,int,int)" ***@***.***@tensorflow@@***@***.***@***@***.***@z) [C:\tf_jenkins\home\workspace\tensorflow-pr-win-cmake-py\cmake_build\pywrap_tensorflow_internal.vcxproj]
08:30:35 4>queue_runner.obj : error LNK2001: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl tensorflow::SanitizeThreadSuffix(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" ***@***.***@@***@***.******@***.***@std@@***@***.***@2@@std@@v23@@z) [C:\tf_jenkins\home\workspace\tensorflow-pr-win-cmake-py\cmake_build\pywrap_tensorflow_internal.vcxproj]
08:30:35 4>single_machine.obj : error LNK2001: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl tensorflow::SanitizeThreadSuffix(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" ***@***.***@@***@***.******@***.***@std@@***@***.***@2@@std@@v23@@z) [C:\tf_jenkins\home\workspace\tensorflow-pr-win-cmake-py\cmake_build\pywrap_tensorflow_internal.vcxproj]
08:30:35 4>C:\tf_jenkins\home\workspace\tensorflow-pr-win-cmake-py\cmake_build\Release\pywrap_tensorflow_internal.dll : fatal error LNK1120: 1 unresolved externals [C:\tf_jenkins\home\workspace\tensorflow-pr-win-cmake-py\cmake_build\pywrap_tensorflow_internal.vcxproj]
08:30:35 4>Done Building Project "C:\tf_jenkins\home\workspace\tensorflow-pr-win-cmake-py\cmake_build\pywrap_tensorflow_internal.vcxproj" (default targets) -- FAILED.
08:30:35 1>Done Building Project "c:\tf_jenkins\home\workspace\tensorflow-pr-win-cmake-py\cmake_build\tf_python_build_pip_package.vcxproj" (default targets) -- FAILED.
08:30:35
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8891 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABtimyfi2aA2Y03b1ch_ZqYtAI-P5Yokks5sV1L6gaJpZM4MwTz9>
.
|
Right. Merging. |
…assification * commit '6e054dbd4b741d5b8fa8af93fdd7c9b74ae67ce0': (511 commits) Fix tensordot with list of ints as axes (tensorflow#11959) Fix segfault when recording raw allocation returns nullptr (tensorflow#12074) [OpenCL] Fix for //tensorflow/python/kernel_tests:image_ops_test (tensorflow#111) (tensorflow#12041) Removing visited_node hash table - fixing multinode shape mismatch issue (tensorflow#12044) [OpenCL] Fixes core_rnn_cell_tests (tensorflow#12076) Added Convolutional LSTM (tensorflow#8891) Update monitors_test.py (tensorflow#12062) fix a typo in tf.nn.separable_conv2d's doc (tensorflow#12067) Fix cmake builds: (tensorflow#12048) Fix typo in RELEASE.md (tensorflow#12064) Fix typo (tensorflow#12069) Handle case where init node is not present in the frozen graph. Fix typo in datasets docstring tfdbg: fix a bug in string representation of SparseTensors BUILD dependency cleanup in tensorflow/stream_executor/cuda BUILD dependency cleanups. Rename RecvTensorAsync method to GrpcRecvTensorAsync to fix shadowing of method in Worker with a different signature. [tpu:profiler] Dump gzipped json trace. Minor cleanup tf.nn.separable_conv2d now supports data_format. Avoid unnecessary transposes in tf.layers.separable_conv2d (and implicitly in tf.contrib.layers.separable_conv2d). Add an identity initializer that works with partitioned variables. ...
Hi @loliverhennigh I am trying to use it together with |
Hey @Icnature, I wrote a little silly example of how to use the |
Thanks @loliverhennigh ! I figured out my mistake. I was actually trying |
@loliverhennigh |
In the original paper they use peephole connections (i.e. the gates depend on the hidden state) but as far as I can tell these connections are not present in the implementation. Is this intentional? Might be worth it do mention in the documentation in that case. |
Hi @loliverhennigh! I get a typical
|
for shape in shapes: | ||
if len(shape) not in [3,4,5]: | ||
raise ValueError("Conv Linear expects 3D, 4D or 5D arguments: %s" % str(shapes)) | ||
if len(shape) != len(shapes[0]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could just use shape_length
instead of recalculating it again.
Added an implementation of convolutional lstms (https://arxiv.org/abs/1506.04214). Related to this issue #4536 .