Issue 1:
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: #2118) 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->conv2->conv3->deconv1->deconv2->deconv3). With stride >1 there is no way for doing this with layers interface right now.

Issue 2:
System information

Have I written custom code (as opposed to using a stock example script provided in TensorFlow): yes

OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10

TensorFlow installed from (source or binary): source

TensorFlow version (use command below): v1.7.1

Python version: 3.6

Bazel version (if compiling from source): Not used

GCC/Compiler version (if compiling from source): Visual Studio 2015 (MSBuild.exe)

CUDA/cuDNN version: CUDA 9.1, cuDNN 7.0.5

GPU model and memory: NVIDIA GeForce GTX 1070

Exact command to reproduce:

Open cmd

Go to the directory where a saved model is stored.

Run the following command

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"

Describe the problem

I had the following error after running the command.

[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.

[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.

[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: └

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

(both text and binary parsing failed for file saved_model.pb)

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

Flags:

--in_graph="" string input graph file name

--out_graph="" string output graph file name

--inputs="" string inputs

--outputs="" string outputs

--transforms="" string list of transforms

--output_as_text=false bool whether to write the graph in text protobuf format

Transforms are:

add_default_attributes

backport_concatv2

backport_tensor_array_v3

flatten_atrous_conv

fold_batch_norms

fold_constants

fold_old_batch_norms

freeze_requantization_ranges

fuse_pad_and_conv

fuse_resize_and_conv

fuse_resize_pad_and_conv

insert_logging

merge_duplicate_nodes

obfuscate_names

quantize_nodes

quantize_weights

remove_attribute

remove_control_dependencies

remove_device

remove_nodes

rename_attribute

rename_op

round_weights

set_device

sort_by_execution_order

sparsify_gather

strip_unused_nodes

Source code / logs

I created a saved model using Estimator. The following shows how I create a saved model.

# 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)