Skip to content

Commit 47ef89a

Browse files
authored
Merge pull request #49 from onnx/gs/onnx-1.2
upsample scales must be nchw, update to onnx-1.2.2
2 parents 1ed0964 + 94e6c81 commit 47ef89a

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,5 @@ def run(self):
8080
8181
author_email='[email protected]',
8282
url='https://github.com/onnx/tensorflow-onnx',
83-
install_requires=['numpy>=1.14.1', 'onnx>=1.2']
83+
install_requires=['numpy>=1.14.1', 'onnx>=1.2.2']
8484
)

tests/unity.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
3DBall:
22
# caffe2: needs RandomNormal
3-
# onnxmsrtnext: int->float cast fails
3+
# onnxmsrtnext: fails on missing onnx min/max broadcast
44
disabled: true
55
url: https://github.com/Unity-Technologies/ml-agents/raw/master/unity-environment/Assets/ML-Agents/Examples/3DBall/TFModels/3DBall.bytes
66
model: 3DBall.bytes
@@ -58,7 +58,7 @@ Basic:
5858

5959
Bouncer:
6060
# caffe2: needs RandomNormal
61-
# onnxmsrtnext: int->float cast fails
61+
# onnxmsrtnext: fails on missing onnx min/max broadcast
6262
disabled: true
6363
url: https://github.com/Unity-Technologies/ml-agents/raw/master/unity-environment/Assets/ML-Agents/Examples/Bouncer/TFModels/Bouncer.bytes
6464
model: Bouncer.bytes
@@ -71,7 +71,7 @@ Bouncer:
7171

7272
crawler:
7373
# caffe2: needs RandomNormal
74-
# onnxmsrtnext: int->float cast fails
74+
# onnxmsrtnext: fails on missing onnx min/max broadcast
7575
disabled: true
7676
url: https://github.com/Unity-Technologies/ml-agents/raw/master/unity-environment/Assets/ML-Agents/Examples/Crawler/TFModels/crawler.bytes
7777
model: crawler.bytes
@@ -135,7 +135,7 @@ PushBlock:
135135

136136
Reacher:
137137
# caffe2: needs RandomNormal
138-
# onnxmsrtnext: int->float cast fails
138+
# onnxmsrtnext: fails on missing onnx min/max broadcast
139139
disabled: true
140140
url: https://github.com/Unity-Technologies/ml-agents/raw/master/unity-environment/Assets/ML-Agents/Examples/Reacher/TFModels/Reacher.bytes
141141
model: Reacher.bytes

tf2onnx/tfonnx.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ def tensorflow_to_onnx(graph):
3838
# ignore the following attributes
3939
ignored_attr = ["unknown_rank", "_class", "Tidx", "Tshape", "use_cudnn_on_gpu", "Index",
4040
"Tpaddings", "TI", "Tparams", "Tindices", "Tlen", "Tdim", "dynamic_size", "element_shape",
41-
"Tmultiples", "output_dtype", "Tblock_shape", "Tcrops", "index_type", "Taxis", "U"]
41+
"Tmultiples", "output_dtype", "Tblock_shape", "Tcrops", "index_type", "Taxis", "U",
42+
"maxval", "Tout"]
4243
# some stats
4344
op_cnt = collections.Counter()
4445
attr_cnt = collections.Counter()
@@ -757,8 +758,8 @@ def upsample_op7(ctx, node, name, args):
757758
# wants the input to be NHWC - adjust target_shape to this.
758759
n, h, w, c = shape
759760
nh, nw = target_shape
760-
# scaler = [float(n), float(nh) / h, float(nw) / w, float(c)]
761-
scaler = [float(nh) / h, float(nw) / w]
761+
# scaler is nchw
762+
scaler = [1., 1., float(nh) / h, float(nw) / w]
762763
node.set_attr("scales", scaler)
763764
node.set_attr("mode", mode)
764765
ctx.remove_input(node, node.input[1])

0 commit comments

Comments
 (0)