Skip to content

Commit

Permalink
Merge pull request tensorflow#10687 from av8ramit/cherrypicks
Browse files Browse the repository at this point in the history
Cherrypicks
  • Loading branch information
Amit Patankar committed Jun 13, 2017
2 parents 323d40f + f60dfcb commit 917ed30
Show file tree
Hide file tree
Showing 16 changed files with 454 additions and 13 deletions.
2 changes: 2 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@
checkpoints containing such RNN cells, in which case you can use the
[checkpoint_convert script](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/rnn/python/tools/checkpoint_convert.py)
to convert the variable names in your old checkpoints.
* Added `tf.contrib.kernel_methods` module with Ops and estimators for primal
(explicit) kernel methods in TensorFlow.

## Bug Fixes and Other Changes
* In python, `Operation.get_attr` on type attributes returns the Python DType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def test_build_standardized_signature_def_classification6(self):
dtype_int64 = types_pb2.DataType.Value("DT_INT64")
dtype_float = types_pb2.DataType.Value("DT_FLOAT")
expected_signature_def.inputs[
signature_constants.PREDICT_INPUTS].CopyFrom(
"input-1"].CopyFrom(
meta_graph_pb2.TensorInfo(
name="input-tensor-1:0", dtype=dtype_float, tensor_shape=shape))
expected_signature_def.outputs["classes"].CopyFrom(
Expand Down Expand Up @@ -516,8 +516,8 @@ def test_build_all_signature_defs(self):
output_2, None),
"default_input_alternative:head-3":
signature_def_utils.predict_signature_def({
"input": input_example
}, {"output": output_3}),
"default input": input_example
}, {"some_output_3": output_3}),
# "features_input_alternative:head-1":
# signature_def_utils.regression_signature_def(input_features,
# output_1),
Expand Down
2 changes: 2 additions & 0 deletions tensorflow/python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
from tensorflow.core.framework.summary_pb2 import *
from tensorflow.core.framework.attr_value_pb2 import *
from tensorflow.core.protobuf.meta_graph_pb2 import TensorInfo
from tensorflow.core.protobuf.meta_graph_pb2 import MetaGraphDef
from tensorflow.core.protobuf.config_pb2 import *
from tensorflow.core.protobuf.tensorflow_server_pb2 import *
from tensorflow.core.util.event_pb2 import *
Expand Down Expand Up @@ -143,6 +144,7 @@
'GraphOptions',
'HistogramProto',
'LogMessage',
'MetaGraphDef',
'NameAttrList',
'NodeDef',
'OptimizerOptions',
Expand Down
4 changes: 2 additions & 2 deletions tensorflow/python/estimator/export/export_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ def test_build_all_signature_defs_explicit_default(self):
output_2, None),
"head-3":
signature_def_utils.predict_signature_def({
"input": receiver_tensor
}, {"output": output_3})
"receiver": receiver_tensor
}, {"some_output_3": output_3})
}

self.assertDictEqual(expected_signature_defs, signature_defs)
Expand Down
6 changes: 6 additions & 0 deletions tensorflow/python/framework/framework_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
@@import_graph_def
@@load_file_system_library
@@load_op_library
@@make_tensor_proto
@@make_ndarray
## Graph collections
Expand Down Expand Up @@ -98,6 +100,10 @@
from tensorflow.python.framework.subscribe import subscribe
from tensorflow.python.framework.importer import import_graph_def

# Utilities for working with Tensors
from tensorflow.python.framework.tensor_util import make_tensor_proto
from tensorflow.python.framework.tensor_util import MakeNdarray as make_ndarray

# Needed when you defined a new Op in C++.
from tensorflow.python.framework.ops import RegisterGradient
from tensorflow.python.framework.ops import NotDifferentiable
Expand Down
5 changes: 5 additions & 0 deletions tensorflow/python/ops/variable_scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -1501,6 +1501,11 @@ def variable_scope(name_or_scope,
A note about name scoping: Setting `reuse` does not impact the naming of other
ops such as mult. See related discussion on [github#6189](https://github.com/tensorflow/tensorflow/issues/6189)
Note that up to and including version 1.0, it was allowed (though
explicitly discouraged) to pass False to the reuse argument, yielding
undocumented behaviour slightly different from None. Starting at 1.1.0
passing None and False as reuse has exactly the same effect.
Args:
name_or_scope: `string` or `VariableScope`: the scope to open.
default_name: The default name to use if the `name_or_scope` argument is
Expand Down
4 changes: 4 additions & 0 deletions tensorflow/python/platform/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
# Import Benchmark class
Benchmark = _googletest.Benchmark # pylint: disable=invalid-name

# Import StubOutForTesting class
StubOutForTesting = _googletest.StubOutForTesting # pylint: disable=invalid-name


def main(argv=None):
"""Runs all unit tests."""
Expand Down Expand Up @@ -117,6 +120,7 @@ def is_gpu_available(cuda_only=False):
# We piggy-back googletest documentation.
'Benchmark',
'mock',
'StubOutForTesting',
]

remove_undocumented(__name__, _allowed_symbols)
8 changes: 0 additions & 8 deletions tensorflow/python/saved_model/signature_def_utils_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,6 @@ def predict_signature_def(inputs, outputs):
if outputs is None:
raise ValueError('outputs cannot be None or empty for prediction.')

# If there's only one input or output, we can standardize keys
if len(inputs) == 1:
(_, value), = inputs.items()
inputs = {signature_constants.PREDICT_INPUTS: value}
if len(outputs) == 1:
(_, value), = outputs.items()
outputs = {signature_constants.PREDICT_OUTPUTS: value}

signature_inputs = {key: utils.build_tensor_info(tensor)
for key, tensor in inputs.items()}
signature_outputs = {key: utils.build_tensor_info(tensor)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
path: "tensorflow.MetaGraphDef.CollectionDefEntry"
tf_class {
is_instance: "<class \'tensorflow.core.protobuf.meta_graph_pb2.CollectionDefEntry\'>"
is_instance: "<type \'google.protobuf.pyext._message.CMessage\'>"
member {
name: "DESCRIPTOR"
mtype: "<type \'google.protobuf.pyext._message.MessageDescriptor\'>"
}
member {
name: "Extensions"
mtype: "<type \'getset_descriptor\'>"
}
member {
name: "KEY_FIELD_NUMBER"
mtype: "<type \'int\'>"
}
member {
name: "VALUE_FIELD_NUMBER"
mtype: "<type \'int\'>"
}
member_method {
name: "ByteSize"
}
member_method {
name: "Clear"
}
member_method {
name: "ClearExtension"
}
member_method {
name: "ClearField"
}
member_method {
name: "CopyFrom"
}
member_method {
name: "DiscardUnknownFields"
}
member_method {
name: "FindInitializationErrors"
}
member_method {
name: "FromString"
}
member_method {
name: "HasExtension"
}
member_method {
name: "HasField"
}
member_method {
name: "IsInitialized"
}
member_method {
name: "ListFields"
}
member_method {
name: "MergeFrom"
}
member_method {
name: "MergeFromString"
}
member_method {
name: "ParseFromString"
}
member_method {
name: "RegisterExtension"
}
member_method {
name: "SerializePartialToString"
}
member_method {
name: "SerializeToString"
}
member_method {
name: "SetInParent"
}
member_method {
name: "WhichOneof"
}
member_method {
name: "__init__"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
path: "tensorflow.MetaGraphDef.MetaInfoDef"
tf_class {
is_instance: "<class \'tensorflow.core.protobuf.meta_graph_pb2.MetaInfoDef\'>"
is_instance: "<type \'google.protobuf.pyext._message.CMessage\'>"
member {
name: "ANY_INFO_FIELD_NUMBER"
mtype: "<type \'int\'>"
}
member {
name: "DESCRIPTOR"
mtype: "<type \'google.protobuf.pyext._message.MessageDescriptor\'>"
}
member {
name: "Extensions"
mtype: "<type \'getset_descriptor\'>"
}
member {
name: "META_GRAPH_VERSION_FIELD_NUMBER"
mtype: "<type \'int\'>"
}
member {
name: "STRIPPED_OP_LIST_FIELD_NUMBER"
mtype: "<type \'int\'>"
}
member {
name: "TAGS_FIELD_NUMBER"
mtype: "<type \'int\'>"
}
member {
name: "TENSORFLOW_GIT_VERSION_FIELD_NUMBER"
mtype: "<type \'int\'>"
}
member {
name: "TENSORFLOW_VERSION_FIELD_NUMBER"
mtype: "<type \'int\'>"
}
member_method {
name: "ByteSize"
}
member_method {
name: "Clear"
}
member_method {
name: "ClearExtension"
}
member_method {
name: "ClearField"
}
member_method {
name: "CopyFrom"
}
member_method {
name: "DiscardUnknownFields"
}
member_method {
name: "FindInitializationErrors"
}
member_method {
name: "FromString"
}
member_method {
name: "HasExtension"
}
member_method {
name: "HasField"
}
member_method {
name: "IsInitialized"
}
member_method {
name: "ListFields"
}
member_method {
name: "MergeFrom"
}
member_method {
name: "MergeFromString"
}
member_method {
name: "ParseFromString"
}
member_method {
name: "RegisterExtension"
}
member_method {
name: "SerializePartialToString"
}
member_method {
name: "SerializeToString"
}
member_method {
name: "SetInParent"
}
member_method {
name: "WhichOneof"
}
member_method {
name: "__init__"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
path: "tensorflow.MetaGraphDef.SignatureDefEntry"
tf_class {
is_instance: "<class \'tensorflow.core.protobuf.meta_graph_pb2.SignatureDefEntry\'>"
is_instance: "<type \'google.protobuf.pyext._message.CMessage\'>"
member {
name: "DESCRIPTOR"
mtype: "<type \'google.protobuf.pyext._message.MessageDescriptor\'>"
}
member {
name: "Extensions"
mtype: "<type \'getset_descriptor\'>"
}
member {
name: "KEY_FIELD_NUMBER"
mtype: "<type \'int\'>"
}
member {
name: "VALUE_FIELD_NUMBER"
mtype: "<type \'int\'>"
}
member_method {
name: "ByteSize"
}
member_method {
name: "Clear"
}
member_method {
name: "ClearExtension"
}
member_method {
name: "ClearField"
}
member_method {
name: "CopyFrom"
}
member_method {
name: "DiscardUnknownFields"
}
member_method {
name: "FindInitializationErrors"
}
member_method {
name: "FromString"
}
member_method {
name: "HasExtension"
}
member_method {
name: "HasField"
}
member_method {
name: "IsInitialized"
}
member_method {
name: "ListFields"
}
member_method {
name: "MergeFrom"
}
member_method {
name: "MergeFromString"
}
member_method {
name: "ParseFromString"
}
member_method {
name: "RegisterExtension"
}
member_method {
name: "SerializePartialToString"
}
member_method {
name: "SerializeToString"
}
member_method {
name: "SetInParent"
}
member_method {
name: "WhichOneof"
}
member_method {
name: "__init__"
}
}
Loading

0 comments on commit 917ed30

Please sign in to comment.