mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Add Upsample example for torch onnx exporting
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/10550 Reviewed By: orionr Differential Revision: D9541932 Pulled By: houseroad fbshipit-source-id: 4d179d189c176482ae919e5cc74607b9d315ed26
This commit is contained in:
committed by
Facebook Github Bot
parent
22c9bc3117
commit
5ed62ea6fa
71
test/onnx/expect/TestOperators.test_upsample.expect
Normal file
71
test/onnx/expect/TestOperators.test_upsample.expect
Normal file
@ -0,0 +1,71 @@
|
||||
ir_version: 3
|
||||
producer_name: "pytorch"
|
||||
producer_version: "0.4"
|
||||
graph {
|
||||
node {
|
||||
input: "0"
|
||||
output: "1"
|
||||
op_type: "Upsample"
|
||||
attribute {
|
||||
name: "mode"
|
||||
s: "bilinear"
|
||||
type: STRING
|
||||
}
|
||||
attribute {
|
||||
name: "scales"
|
||||
floats: 1
|
||||
floats: 1
|
||||
floats: 2
|
||||
floats: 2
|
||||
type: FLOATS
|
||||
}
|
||||
}
|
||||
name: "torch-jit-export"
|
||||
input {
|
||||
name: "0"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: FLOAT
|
||||
shape {
|
||||
dim {
|
||||
dim_value: 1
|
||||
}
|
||||
dim {
|
||||
dim_value: 2
|
||||
}
|
||||
dim {
|
||||
dim_value: 3
|
||||
}
|
||||
dim {
|
||||
dim_value: 4
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
output {
|
||||
name: "1"
|
||||
type {
|
||||
tensor_type {
|
||||
elem_type: FLOAT
|
||||
shape {
|
||||
dim {
|
||||
dim_value: 1
|
||||
}
|
||||
dim {
|
||||
dim_value: 2
|
||||
}
|
||||
dim {
|
||||
dim_value: 6
|
||||
}
|
||||
dim {
|
||||
dim_value: 8
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
opset_import {
|
||||
version: 7
|
||||
}
|
@ -416,6 +416,10 @@ class TestOperators(TestCase):
|
||||
x = Variable(torch.randn(1, 2, 3, 4), requires_grad=True)
|
||||
self.assertONNX(lambda x: x.norm(dim=2), (x))
|
||||
|
||||
def test_upsample(self):
|
||||
x = Variable(torch.randn(1, 2, 3, 4), requires_grad=True)
|
||||
self.assertONNX(lambda x: nn.functional.interpolate(x, scale_factor=2., mode='bilinear'), x)
|
||||
|
||||
def test_symbolic_override(self):
|
||||
"""Lifted from fast-neural-style: custom implementation of instance norm
|
||||
to be mapped to ONNX operator"""
|
||||
|
Reference in New Issue
Block a user