<h3 dir="auto">System information</h3>
<ul dir="auto">
<li><strong>Have I written custom code (as opposed to using a stock example script provided in TensorFlow)</strong>: yes (n/a)</li>
<li><strong>OS Platform and Distribution (e.g., Linux Ubuntu 16.04)</strong>: Linux Ubuntu 16.04 (All affected)</li>
<li><strong>TensorFlow installed from (source or binary)</strong>: binary</li>
<li><strong>TensorFlow version (use command below)</strong>: 1.4.0</li>
<li><strong>Python version</strong>: 3.6</li>
<li><strong>Bazel version (if compiling from source)</strong>: n/a</li>
<li><strong>GCC/Compiler version (if compiling from source)</strong>: n/a</li>
<li><strong>CUDA/cuDNN version</strong>: n/a</li>
<li><strong>GPU model and memory</strong>: CPU</li>
<li><strong>Exact command to reproduce</strong>: n/a</li>
</ul>
<h3 dir="auto">Describe the problem</h3>
<p dir="auto">tensorflow.layers.Conv3DTranspose doesn't work when the input dimensions are not specified and bias is added.  This occurs because the layer output is reshaped from five dimensions to 4 by combining the depth and height dimensions:  None * None throws an exception.  The code for this is in tensorflow/python/layers/convolutional.py, line 1608.</p>
<p dir="auto">It appears that this reshaping is done because nn.bias.add can't handle 5 dimensional inputs.  This seems like it should be an easy fix since nn.bias.add just broadcasts across all but the channel dimension anyway.  The *Transpose layers should really all use the same general _ConvTranspose style that the non-transposed convolution layers use, to avoid code duplication.</p>
<p dir="auto">In the meantime, tensorflow.layers.Conv3D DOES work with unspecified input dimensions and channel-last ordering.  It turns out that Conv3D and Conv3DTranspose use different code for adding the bias.  In lieu of a nn.bias.add fix, this problem can be alleviated by using the Conv3D bias code for Conv3DTranspose.</p>
<h3 dir="auto">Suggested fix (tested)</h3>
<p dir="auto">In tensorflow/python/layers/convolutional.py, replace lines 1609-1625 with (modified from lines 169-189):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    if self.data_format == 'channels_first':
          outputs_shape = outputs.shape.as_list()
          outputs_4d = array_ops.reshape(outputs,
                                         [outputs_shape[0], outputs_shape[1],
                                          outputs_shape[2] * outputs_shape[3],
                                          outputs_shape[4]])
          outputs_4d = nn.bias_add(outputs_4d, self.bias, data_format='NCHW')
          outputs = array_ops.reshape(outputs_4d, outputs_shape)
      else:
        outputs = nn.bias_add(outputs, self.bias, data_format='NHWC')"><pre class="notranslate"><code class="notranslate">    if self.data_format == 'channels_first':
          outputs_shape = outputs.shape.as_list()
          outputs_4d = array_ops.reshape(outputs,
                                         [outputs_shape[0], outputs_shape[1],
                                          outputs_shape[2] * outputs_shape[3],
                                          outputs_shape[4]])
          outputs_4d = nn.bias_add(outputs_4d, self.bias, data_format='NCHW')
          outputs = array_ops.reshape(outputs_4d, outputs_shape)
      else:
        outputs = nn.bias_add(outputs, self.bias, data_format='NHWC')
</code></pre></div>
<p dir="auto">The issue have beed submitted in <a href="https://github.com/tensorflow/serving/issues/381" data-hovercard-type="issue" data-hovercard-url="/tensorflow/serving/issues/381/hovercard">#381</a>, thanks all kind of you</p>