Skip to content

Conversation

@KsenijaS
Copy link
Contributor

No description provided.

Lara Haidar-Ahmad and others added 30 commits April 15, 2019 15:27
add a comment about _registry
@pytorchbot pytorchbot added oncall: jit Add this issue/PR to JIT oncall triage queue module: build Build system issues module: onnx Related to torch.onnx labels Jun 14, 2019
@KsenijaS KsenijaS changed the title Laras PyTorch export to ONNX Opset 7 and 8 Jun 14, 2019
@zhangguanheng66
Copy link
Contributor

@houseroad appreciate if you have time to review this PR. Thanks.

@zhangguanheng66 zhangguanheng66 added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Jun 14, 2019
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@houseroad has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@spandantiwari
Copy link

@KsenijaS - some of these commits from @lara-hdr 's branch may already be in master. Could you please rebase onto master once. Let us know if we can help.

Copy link
Member

@houseroad houseroad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, it's useful to support opset 7 and 8. However, we should not let opset 7 and 8 reply on opset 9. Instead, it should be the opposite way.

case at::ScalarType::Int:
case at::ScalarType::Short:
case at::ScalarType::Bool:
to_type = 6; // Int32
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: use Enum instead of using int directly.

break;

case at::ScalarType::Long:
to_type = 7; // Int64
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

using namespace ::c10::onnx;
}

void CastConstant(Block* block) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the motivation of adding this CastConstant pass?

// see .cpp for docs
TORCH_API void CastConstant(const std::shared_ptr<Graph>& graph);
} // namespace jit
} // namespace torch No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline character?

from torch.onnx.symbolic_helper import _black_list_in_opset
from torch.onnx.symbolic_opset9 import _adaptive_pool, _pair, _single, _triple, max_pool1d, max_pool2d, max_pool3d

black_listed_operators = ["scan", "expand"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the right way to add support for opset 7 and opset 8 is putting all the operators in the black_list_operators... Let's don't import anything from opset 9, since it's very tricky to get it correct this way.


# if a opset version is less than 9 check if model has a constant int node
# and if so add a cast to it
if _export_onnx_opset_version < 9:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you elaborate more?

not is_registered_op(op[0], domain, version):
register_op(op[0], op[1], domain, version)
iter_version = iter_version - 1
while iter_version != 9:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest not registering op set 9 everywhere.

facebook-github-bot pushed a commit that referenced this pull request Jul 12, 2019
Summary:
This is an extension to the original PR #21765

1. Increase the coverage of different opsets support, comments, and blacklisting.
2. Adding backend tests for both caffe2 and onnxruntime on opset 7 and opset 8.
3. Reusing onnx model tests in caffe2 for onnxruntime.
Pull Request resolved: #22421

Reviewed By: zrphercule

Differential Revision: D16225518

Pulled By: houseroad

fbshipit-source-id: 01ae3eed85111a83a0124e9e95512b80109d6aee
@houseroad
Copy link
Member

#22421 has been merged already. So close this PR.

@houseroad houseroad closed this Jul 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: build Build system issues module: onnx Related to torch.onnx oncall: jit Add this issue/PR to JIT oncall triage queue open source triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants