Skip to content

Commit

Permalink
add commit value to onnx file, remove expired code and add License in…
Browse files Browse the repository at this point in the history
… generating version.py

Signed-off-by: Deyu Huang <deyhuang@microsoft.com>
Co-authored-by: Guenther Schmuelling <guschmue@microsoft.com>
  • Loading branch information
hwangdeyu and guschmue committed Mar 29, 2022
1 parent 8e43a17 commit b60ab62
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 16 deletions.
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ def finalize_options(self):
pass

def run(self):
alv2_license = "# SPDX-License-Identifier: Apache-2.0\n\n"
with open(os.path.join(SRC_DIR, 'version.py'), 'w') as f:
f.write(dedent('''
f.write(alv2_license + dedent('''
version = '{version}'
git_version = '{git_version}'
'''.format(**dict(VersionInfo._asdict()))))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
- [Densely Connected Convolutional Networks](https://arxiv.org/pdf/1608.06993.pdf)
- [The One Hundred Layers Tiramisu: Fully Convolutional DenseNets for Semantic Segmentation](https://arxiv.org/pdf/1611.09326.pdf)
'''
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division

import warnings

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
# From https://github.com/titu1994/DenseNet/blob/master/subpixel.py
# Modifications Copyright (c) Microsoft.

from __future__ import absolute_import

from mock_keras2onnx.proto import keras
from keras import backend as K
from keras.engine import Layer
Expand Down
3 changes: 1 addition & 2 deletions tf2onnx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"tfonnx", "shape_inference", "schemas", "tf_utils", "tf_loader", "convert"]

import onnx
from .version import version as __version__
from .version import git_version, version as __version__
from . import verbose_logging as logging
from tf2onnx import tfonnx, utils, graph, graph_builder, graph_matcher, shape_inference, schemas, convert # pylint: disable=wrong-import-order
#from tf2onnx import tf_utils, tf_loader
13 changes: 7 additions & 6 deletions tf2onnx/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import numpy as np

from onnx import helper, numpy_helper, shape_inference, AttributeProto, TensorProto
from tf2onnx import utils, __version__
from tf2onnx import utils, __version__, git_version
from tf2onnx.utils import make_name, port_name, find_opset
from tf2onnx import optimizer
from tf2onnx.schemas import get_schema, infer_onnx_shape_dtype
Expand Down Expand Up @@ -1189,9 +1189,10 @@ def make_model(self, graph_doc, optimize=False, graph_name="tf2onnx", external_t
graph = self.make_graph(graph_doc, graph_name, external_tensor_storage)

if "producer_name" not in kwargs:
kwargs = {"producer_name": "tf2onnx",
"producer_version": __version__}

kwargs = {
"producer_name": "tf2onnx",
"producer_version": __version__ + " " + git_version[:6]
}
if "opset_imports" not in kwargs:
opsets = [helper.make_opsetid(constants.ONNX_DOMAIN, self._opset)]
opsets.append(constants.AI_ONNX_ML_OPSET)
Expand Down Expand Up @@ -1605,7 +1606,7 @@ def safe_remove_nodes(self, to_delete):
self.remove_node(n.name)

def is_safe_to_remove_nodes(self, to_delete, outputs_to_ignore=None):
"""Returns true if the outputs of all the nodes in to_delete have no third-party nodes consuming them"""
"""Returns true if the outputs of all the nodes in to_delete have no third-party nodes consuming them."""
delete_set = set(to_delete)
outputs_to_ignore_set = set(outputs_to_ignore or [])
for n in delete_set:
Expand Down Expand Up @@ -1660,7 +1661,7 @@ def optimize_model_proto(onnx_model_proto, catch_errors=True, return_graph=False

@staticmethod
def get_onnx_model_properties(onnx_model_proto):
"""Get ModelProto properties"""
"""Get ModelProto properties."""
kwargs = {}
if onnx_model_proto.HasField('ir_version'):
kwargs["ir_version"] = onnx_model_proto.ir_version
Expand Down
2 changes: 1 addition & 1 deletion tf2onnx/tfonnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ def process_tf_graph(tf_graph, continue_on_error=False, verbose=False, target=No

opset = utils.find_opset(opset)
logger.info("Using tensorflow=%s, onnx=%s, tf2onnx=%s/%s",
get_tf_version(), utils.get_onnx_version(), tf2onnx.__version__, tf2onnx.version.git_version[:6])
get_tf_version(), utils.get_onnx_version(), tf2onnx.__version__, tf2onnx.git_version[:6])
logger.info("Using opset <onnx, %s>", opset)
if opset > schemas.get_max_supported_opset_version():
logger.warning("Currently installed onnx package %s is too low to support opset %s, "
Expand Down
3 changes: 2 additions & 1 deletion tf2onnx/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# SPDX-License-Identifier: Apache-2.0


version = '1.10.0'
git_version = '219e00c073f6e73fba7335630dcf1f96cc82c983'
git_version = '8e43a1783a1921a4f5f20d51ae9b48926706a939'

0 comments on commit b60ab62

Please sign in to comment.