<p dir="auto">I believe there is no reason why using layer interface user should not be able to specify this. Output shape is not obvious for some cases (as stated here: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="151235937" data-permission-text="Title is private" data-url="https://github.com/tensorflow/tensorflow/issues/2118" data-hovercard-type="issue" data-hovercard-url="/tensorflow/tensorflow/issues/2118/hovercard" href="https://github.com/tensorflow/tensorflow/issues/2118">#2118</a>) and without accepting output_shape argument one cannot match desired output. Potential use case is trying to build autoencoder for 2d images in form of (conv1-&gt;conv2-&gt;conv3-&gt;deconv1-&gt;deconv2-&gt;deconv3). With stride &gt;1 there is no way for doing this with layers interface right now.</p>
<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</li>
<li><strong>OS Platform and Distribution (e.g., Linux Ubuntu 16.04)</strong>: Windows 10</li>
<li><strong>TensorFlow installed from (source or binary)</strong>: source</li>
<li><strong>TensorFlow version (use command below)</strong>: v1.7.1</li>
<li><strong>Python version</strong>: 3.6</li>
<li><strong>Bazel version (if compiling from source)</strong>: Not used</li>
<li><strong>GCC/Compiler version (if compiling from source)</strong>: Visual Studio 2015 (MSBuild.exe)</li>
<li><strong>CUDA/cuDNN version</strong>: CUDA 9.1, cuDNN 7.0.5</li>
<li><strong>GPU model and memory</strong>: NVIDIA GeForce GTX 1070</li>
<li><strong>Exact command to reproduce</strong>:</li>
</ul>
<ol dir="auto">
<li>Open cmd</li>
<li>Go to the directory where a saved model is stored.</li>
<li>Run the following command<br>
PATH\TO\tensorflow-1.7.1\tensorflow\contrib\cmake\build_cuda_v9.1\Release\transform_graph --in_graph=saved_model.pb --out_graph=saved_model_2.pb --inputs="image:0" --outputs="probability:0" --transforms="obfuscate_names"</li>
</ol>
<h3 dir="auto">Describe the problem</h3>
<p dir="auto">I had the following error after running the command.</p>
<p dir="auto">[libprotobuf ERROR D:\workspace_tensorflow_source\tensorflow-1.7.1\tensorflow\contrib\cmake\build_cuda_v9.1\protobuf\src\protobuf\src\google\protobuf\text_format.cc:288] Error parsing text-format tensorflow.GraphDef: 1:1: Invalid control characters encountered in text.<br>
[libprotobuf ERROR D:\workspace_tensorflow_source\tensorflow-1.7.1\tensorflow\contrib\cmake\build_cuda_v9.1\protobuf\src\protobuf\src\google\protobuf\text_format.cc:288] Error parsing text-format tensorflow.GraphDef: 1:4: Interpreting non ascii codepoint 192.<br>
[libprotobuf ERROR D:\workspace_tensorflow_source\tensorflow-1.7.1\tensorflow\contrib\cmake\build_cuda_v9.1\protobuf\src\protobuf\src\google\protobuf\text_format.cc:288] Error parsing text-format tensorflow.GraphDef: 1:4: Expected identifier, got: └<br>
2018-05-22 13:39:08.760764: E D:\workspace_tensorflow_source\tensorflow-1.7.1\tensorflow\tools\graph_transforms\transform_graph.cc:200] Loading graph 'saved_model.pb' failed with Can't parse saved_model.pb as binary proto<br>
(both text and binary parsing failed for file saved_model.pb)<br>
2018-05-22 13:39:08.767541: E D:\workspace_tensorflow_source\tensorflow-1.7.1\tensorflow\tools\graph_transforms\transform_graph.cc:202] usage: D:\workspace_tensorflow_source\tensorflow-1.7.1\tensorflow\contrib\cmake\build_cuda_v9.1\Release\transform_graph<br>
Flags:<br>
--in_graph=""                           string  input graph file name<br>
--out_graph=""                          string  output graph file name<br>
--inputs=""                             string  inputs<br>
--outputs=""                            string  outputs<br>
--transforms=""                         string  list of transforms<br>
--output_as_text=false                  bool    whether to write the graph in text protobuf format</p>
<p dir="auto">Transforms are:<br>
add_default_attributes<br>
backport_concatv2<br>
backport_tensor_array_v3<br>
flatten_atrous_conv<br>
fold_batch_norms<br>
fold_constants<br>
fold_old_batch_norms<br>
freeze_requantization_ranges<br>
fuse_pad_and_conv<br>
fuse_resize_and_conv<br>
fuse_resize_pad_and_conv<br>
insert_logging<br>
merge_duplicate_nodes<br>
obfuscate_names<br>
quantize_nodes<br>
quantize_weights<br>
remove_attribute<br>
remove_control_dependencies<br>
remove_device<br>
remove_nodes<br>
rename_attribute<br>
rename_op<br>
round_weights<br>
set_device<br>
sort_by_execution_order<br>
sparsify_gather<br>
strip_unused_nodes</p>
<h3 dir="auto">Source code / logs</h3>
<p dir="auto">I created a saved model using Estimator. The following shows how I create a saved model.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="        # Get warm start settings
        wss = self._get_warm_start_settings()

        # Create a estimator w/ or w/o warm start
        estimator = tf.estimator.Estimator(
            model_fn=NetTrainer.model_fn,
            model_dir=self.model_path,
            params={
                'net_id': str(self.net_id)
            },
            config=tf.estimator.RunConfig(
                save_checkpoints_steps=training_config.CHECKPOINTS_STEPS,
                save_summary_steps=training_config.SUMMARY_STEPS,
                keep_checkpoint_max=training_config.KEEP_CHENCKPOINT_MAX
            ),
            warm_start_from=wss)

        for lp in list(range(0, training_config.NUM_TRAINING_EVALUATION_CYCLES)):
                              
            # Train the model
            estimator.train(
                input_fn=lambda:self.train_input_fn(training_db_reader_state),
                steps=training_config.TRAINING_STEPS,
                max_steps=None)

            # Evaluate the model
            eval_result = estimator.evaluate(
                input_fn=lambda:self.eval_input_fn(evaluation_db_reader_state))
              
            tf.logging.info('training-evaluation cycle: {:d}'.format(lp))
            tf.logging.info('global_step: {global_step:d}'.format(**eval_result))
            tf.logging.info('Test set accuracy: {accuracy:0.3f}'.format(**eval_result))
            
        # Export the model
        image_shape = self._get_image_shape(include_batch=True, batch_size=1);
        feature_spec = {config.IMAGE_KEY: tf.placeholder(tf.float32, shape=image_shape, name=config.IMAGE_KEY)}
        serving_input_receiver_fn = tf.estimator.export.build_raw_serving_input_receiver_fn(feature_spec, default_batch_size=1)

        estimator.export_savedmodel(
            export_dir_base=self.saved_model_path,
            serving_input_receiver_fn=serving_input_receiver_fn,
            strip_default_attrs=True)"><pre class="notranslate"><code class="notranslate">        # Get warm start settings
        wss = self._get_warm_start_settings()

        # Create a estimator w/ or w/o warm start
        estimator = tf.estimator.Estimator(
            model_fn=NetTrainer.model_fn,
            model_dir=self.model_path,
            params={
                'net_id': str(self.net_id)
            },
            config=tf.estimator.RunConfig(
                save_checkpoints_steps=training_config.CHECKPOINTS_STEPS,
                save_summary_steps=training_config.SUMMARY_STEPS,
                keep_checkpoint_max=training_config.KEEP_CHENCKPOINT_MAX
            ),
            warm_start_from=wss)

        for lp in list(range(0, training_config.NUM_TRAINING_EVALUATION_CYCLES)):
                              
            # Train the model
            estimator.train(
                input_fn=lambda:self.train_input_fn(training_db_reader_state),
                steps=training_config.TRAINING_STEPS,
                max_steps=None)

            # Evaluate the model
            eval_result = estimator.evaluate(
                input_fn=lambda:self.eval_input_fn(evaluation_db_reader_state))
              
            tf.logging.info('training-evaluation cycle: {:d}'.format(lp))
            tf.logging.info('global_step: {global_step:d}'.format(**eval_result))
            tf.logging.info('Test set accuracy: {accuracy:0.3f}'.format(**eval_result))
            
        # Export the model
        image_shape = self._get_image_shape(include_batch=True, batch_size=1);
        feature_spec = {config.IMAGE_KEY: tf.placeholder(tf.float32, shape=image_shape, name=config.IMAGE_KEY)}
        serving_input_receiver_fn = tf.estimator.export.build_raw_serving_input_receiver_fn(feature_spec, default_batch_size=1)

        estimator.export_savedmodel(
            export_dir_base=self.saved_model_path,
            serving_input_receiver_fn=serving_input_receiver_fn,
            strip_default_attrs=True)
</code></pre></div>