提交 3d209297 编写于 作者: G Geoffrey Irving

Resolve @annarev's comments

I haven't tested this under Python 2, so here's hoping all the golden
rewrites were done correctly.
上级 6687a0bc
path: "tensorflow.data.Dataset.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.data.FixedLengthRecordDataset.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.data.TFRecordDataset.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.data.TextLineDataset.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.data.experimental.CsvDataset.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.data.experimental.RandomDataset.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.data.experimental.SqlDataset.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
......@@ -10,7 +10,7 @@ tf_module {
}
member {
name: "CsvDataset"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "Optional"
......@@ -18,7 +18,7 @@ tf_module {
}
member {
name: "RandomDataset"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "Reducer"
......@@ -26,7 +26,7 @@ tf_module {
}
member {
name: "SqlDataset"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "StatsAggregator"
......
......@@ -2,11 +2,11 @@ path: "tensorflow.data"
tf_module {
member {
name: "Dataset"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "FixedLengthRecordDataset"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "Iterator"
......@@ -18,11 +18,11 @@ tf_module {
}
member {
name: "TFRecordDataset"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "TextLineDataset"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "experimental"
......
path: "tensorflow.estimator.export.ClassificationOutput.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.estimator.export.ExportOutput.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.estimator.export.PredictOutput.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.estimator.export.RegressionOutput.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
......@@ -2,19 +2,19 @@ path: "tensorflow.estimator.export"
tf_module {
member {
name: "ClassificationOutput"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "ExportOutput"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "PredictOutput"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "RegressionOutput"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "ServingInputReceiver"
......
path: "tensorflow.linalg.LinearOperatorBlockDiag.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperatorCirculant.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperatorCirculant2D.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperatorCirculant3D.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperatorComposition.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperatorDiag.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperatorFullMatrix.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperatorIdentity.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperatorKronecker.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperatorLowRankUpdate.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperatorLowerTriangular.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperatorScaledIdentity.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperatorZeros.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperator.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
......@@ -2,59 +2,59 @@ path: "tensorflow.linalg"
tf_module {
member {
name: "LinearOperator"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorBlockDiag"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorCirculant"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorCirculant2D"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorCirculant3D"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorComposition"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorDiag"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorFullMatrix"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorIdentity"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorKronecker"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorLowRankUpdate"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorLowerTriangular"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorScaledIdentity"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorZeros"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member_method {
name: "adjoint"
......
......@@ -6,10 +6,6 @@ tf_class {
name: "args"
mtype: "<type \'getset_descriptor\'>"
}
member {
name: "message"
mtype: "<type \'getset_descriptor\'>"
}
member_method {
name: "__init__"
}
......
path: "tensorflow.data.Dataset.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.data.FixedLengthRecordDataset.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.data.TFRecordDataset.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.data.TextLineDataset.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.data.experimental.CsvDataset.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.data.experimental.RandomDataset.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.data.experimental.SqlDataset.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
......@@ -10,7 +10,7 @@ tf_module {
}
member {
name: "CsvDataset"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "Optional"
......@@ -18,7 +18,7 @@ tf_module {
}
member {
name: "RandomDataset"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "Reducer"
......@@ -26,7 +26,7 @@ tf_module {
}
member {
name: "SqlDataset"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "StatsAggregator"
......
......@@ -2,11 +2,11 @@ path: "tensorflow.data"
tf_module {
member {
name: "Dataset"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "FixedLengthRecordDataset"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "Iterator"
......@@ -18,11 +18,11 @@ tf_module {
}
member {
name: "TFRecordDataset"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "TextLineDataset"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "experimental"
......
path: "tensorflow.estimator.export.ClassificationOutput.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.estimator.export.ExportOutput.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.estimator.export.PredictOutput.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.estimator.export.RegressionOutput.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
......@@ -2,19 +2,19 @@ path: "tensorflow.estimator.export"
tf_module {
member {
name: "ClassificationOutput"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "ExportOutput"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "PredictOutput"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "RegressionOutput"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "ServingInputReceiver"
......
path: "tensorflow.linalg.LinearOperatorBlockDiag.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperatorCirculant.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperatorCirculant2D.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperatorCirculant3D.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperatorComposition.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperatorDiag.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperatorFullMatrix.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperatorIdentity.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperatorKronecker.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperatorLowRankUpdate.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperatorLowerTriangular.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperatorScaledIdentity.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperatorZeros.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
path: "tensorflow.linalg.LinearOperator.__metaclass__"
tf_class {
is_instance: "<class \'abc.ABCMeta\'>"
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
......
......@@ -2,59 +2,59 @@ path: "tensorflow.linalg"
tf_module {
member {
name: "LinearOperator"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorBlockDiag"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorCirculant"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorCirculant2D"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorCirculant3D"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorComposition"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorDiag"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorFullMatrix"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorIdentity"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorKronecker"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorLowRankUpdate"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorLowerTriangular"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorScaledIdentity"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member {
name: "LinearOperatorZeros"
mtype: "<class \'abc.ABCMeta\'>"
mtype: "<type \'type\'>"
}
member_method {
name: "adjoint"
......
......@@ -6,10 +6,6 @@ tf_class {
name: "args"
mtype: "<type \'getset_descriptor\'>"
}
member {
name: "message"
mtype: "<type \'getset_descriptor\'>"
}
member_method {
name: "__init__"
}
......
......@@ -19,7 +19,7 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import re
import enum
import sys
from google.protobuf import message
from tensorflow.python.platform import tf_logging as logging
......@@ -32,60 +32,44 @@ _CORNER_CASES = {
'': {'tools': {}},
'test.TestCase': {},
'test.TestCase.failureException': {},
'train.NanLossDuringTrainingError': {'message': {}},
}
# Python 2 vs. 3 differences
if sys.version_info.major == 3:
_CODE_ATTR = '__code__'
_CLASS_TO_TYPE = {}
_NORMALIZE_TYPE = {}
for t in ('property', 'object', 'getset_descriptor', 'int', 'str', 'type',
'tuple', 'module', 'collections.defaultdict', 'set', 'dict',
'NoneType', 'frozenset'):
_CLASS_TO_TYPE["<class '%s'>" % t] = "<type '%s'>" % t
_NORMALIZE_TYPE["<class '%s'>" % t] = "<type '%s'>" % t
for e in 'Exception', 'RuntimeError':
_CLASS_TO_TYPE["<class '%s'>" % e] = "<type 'exceptions.%s'>" % e
_NORMALIZE_TYPE["<class '%s'>" % e] = "<type 'exceptions.%s'>" % e
_NORMALIZE_TYPE["<class 'abc.ABCMeta'>"] = "<type 'type'>"
_NORMALIZE_ISINSTANCE = {
"<class 'tensorflow.python.training.monitored_session._MonitoredSession.StepContext'>":
"<class 'tensorflow.python.training.monitored_session._MonitoredSession.StepContext'>": # pylint: disable=line-too-long
"<class 'tensorflow.python.training.monitored_session.StepContext'>",
"<class 'tensorflow.python.ops.variables.Variable.SaveSliceInfo'>":
"<class 'tensorflow.python.ops.variables.SaveSliceInfo'>"}
def _normalize_type(ty):
return _CLASS_TO_TYPE.get(ty, ty)
def _normalize_isinstance(ty):
return _NORMALIZE_ISINSTANCE.get(ty, ty)
def _skip_member(cls, member):
if member == 'with_traceback':
return True
if (cls in ('VariableSynchronization', 'UnconnectedGradients', 'VariableAggregation') and
member in ('name', 'value')):
return True
def normalize_proto(proto):
for kind in 'tf_module', 'tf_class':
if proto.HasField(kind):
for member in getattr(proto, kind).member:
if member.mtype == "<class 'abc.ABCMeta'>":
member.mtype = "<type 'type'>"
if proto.path == 'tensorflow.train.NanLossDuringTrainingError':
del proto.tf_class.member[1]
return (member == 'with_traceback' or
member in ('name', 'value') and isinstance(cls, type) and
issubclass(cls, enum.Enum))
else:
_CODE_ATTR = 'func_code'
def _normalize_type(ty):
return ty
def _normalize_isinstance(ty):
return ty
_NORMALIZE_TYPE = {"<class 'abc.ABCMeta'>": "<type 'type'>"}
_NORMALIZE_ISINSTANCE = {}
def _skip_member(cls, member):
return False
def normalize_proto(proto):
pass
def _normalize_type(ty):
return _NORMALIZE_TYPE.get(ty, ty)
def _normalize_isinstance(ty):
return _NORMALIZE_ISINSTANCE.get(ty, ty)
def _SanitizedArgSpec(obj):
......@@ -185,7 +169,7 @@ class PythonObjectToProtoVisitor(object):
def _AddMember(member_name, member_obj, proto):
"""Add the child object to the object being constructed."""
_, member_obj = tf_decorator.unwrap(member_obj)
if _skip_member(parent.__name__, member_name):
if _skip_member(parent, member_name):
return
if member_name == '__init__' or not member_name.startswith('_'):
if tf_inspect.isroutine(member_obj):
......@@ -194,7 +178,7 @@ class PythonObjectToProtoVisitor(object):
# If member_obj is a python builtin, there is no way to get its
# argspec, because it is implemented on the C side. It also has no
# func_code.
if hasattr(member_obj, _CODE_ATTR):
if hasattr(member_obj, '__code__'):
new_method.argspec = _SanitizedArgSpec(member_obj)
else:
new_member = proto.member.add()
......@@ -229,7 +213,8 @@ class PythonObjectToProtoVisitor(object):
elif tf_inspect.isclass(parent):
# Construct a class.
class_obj = api_objects_pb2.TFAPIClass()
class_obj.is_instance.extend(_normalize_isinstance(i) for i in _SanitizedMRO(parent))
class_obj.is_instance.extend(
_normalize_isinstance(i) for i in _SanitizedMRO(parent))
for name, child in children:
if name in parent_corner_cases:
# If we have an empty entry, skip this object.
......
......@@ -31,7 +31,6 @@ import argparse
import os
import re
import sys
import unittest
import tensorflow as tf
from tensorflow._api import v2 as tf_v2
......@@ -299,7 +298,6 @@ class ApiCompatibilityTest(test.TestCase):
"""Read a filename, create a protobuf from its contents."""
ret_val = api_objects_pb2.TFAPIObject()
text_format.Merge(file_io.read_file_to_string(filename), ret_val)
python_object_to_proto_visitor.normalize_proto(ret_val)
return ret_val
golden_proto_dict = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册