Skip to content

[ONNX] Add quantization support to more single output ops#83008

Closed
justinchuby wants to merge 16 commits intogh/justinchuby/4/basefrom
gh/justinchuby/4/head
Closed

[ONNX] Add quantization support to more single output ops#83008
justinchuby wants to merge 16 commits intogh/justinchuby/4/basefrom
gh/justinchuby/4/head

Conversation

@justinchuby
Copy link
Collaborator

@justinchuby justinchuby commented Aug 8, 2022

Stack from ghstack (oldest at bottom):

#80039

  • Implement quantization support for single output ops
    • quantized::sigmoid
    • quantized::instance_norm
    • aten::reshape
    • aten::reshape_as
    • aten::sum
    • aten::mean
    • aten::prod
    • aten::t
    • aten::numpy_T
    • aten::expand
    • aten::expand_as
    • aten::embedding
    • aten::embedding_bag
    • aten::view
    • aten::select
    • aten::eq
    • aten::ne
    • aten::gt
    • aten::lt
    • aten::le
    • aten::ge
    • quantized::layer_norm
    • aten::elu
    • aten::selu
    • aten::maximum
    • aten::minimum
    • aten::amax
    • aten::amin
    • aten::hardtanh
    • aten::hardswish
    • quantized::group_norm
    • aten::as_strided
    • quantized::leaky_relu
    • aten::transpose
  • Avoid modifying functions in quantized_args and have the wrapper closed over scale and zero_point instead (for purity)
  • Remove magic number and assign it to INT64_MAX
  • implement _unpack_quantized_tensor for handling quantized tensor unpacking to separate the logic from tuple unpacking and for clearer error handling

#80039

- Remove magic number and assign it to INT64_MAX

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Aug 8, 2022

🔗 Helpful links

❌ 1 New Failures

As of commit cd6feb0 (more details on the Dr. CI page):

Expand to see more
  • 1/1 failures introduced in this PR

🕵️ 1 new failure recognized by patterns

The following CI failures do not appear to be due to upstream breakages

See GitHub Actions build pull / linux-docs / build-docs (python) (1/1)

Step: "Unknown" (full log | diagnosis details)

2022-08-23T05:18:17.6475546Z ##[error]The operation was canceled.
2022-08-22T23:24:21.5829999Z copying images... [ 97%] _static/img/tensorboard/add_images.png
2022-08-22T23:24:21.5831868Z copying images... [100%] _static/img/tensorboard/add_hparam.png
2022-08-22T23:24:21.5833426Z 
2022-08-22T23:24:21.6057519Z copying static files... done
2022-08-22T23:24:21.6058126Z copying extra files... done
2022-08-22T23:24:22.0276905Z dumping search index in English (code: en)... done
2022-08-22T23:24:22.1307989Z dumping object inventory... done
2022-08-22T23:24:22.1311164Z build succeeded.
2022-08-22T23:24:22.1312815Z 
2022-08-22T23:24:22.1313248Z The HTML pages are in build/html.
2022-08-23T05:18:17.6475546Z ##[error]The operation was canceled.
2022-08-23T05:18:17.6496048Z Prepare all required actions
2022-08-23T05:18:17.6513162Z ##[group]Run ./.github/actions/chown-workspace
2022-08-23T05:18:17.6513372Z ##[endgroup]
2022-08-23T05:18:17.6526768Z ##[group]Run docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
2022-08-23T05:18:17.6527113Z �[36;1mdocker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .�[0m
2022-08-23T05:18:17.6537604Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2022-08-23T05:18:17.6537818Z env:
2022-08-23T05:18:17.6538053Z   ALPINE_IMAGE: 308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine
2022-08-23T05:18:17.6538281Z ##[endgroup]
2022-08-23T05:18:19.1124258Z Post job cleanup.

This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

#80039

- Remove magic number and assign it to INT64_MAX

[ghstack-poisoned]
#80039

- Remove magic number and assign it to INT64_MAX

[ghstack-poisoned]
justinchuby added a commit that referenced this pull request Aug 8, 2022
- Remove magic number and assign it to INT64_MAX

ghstack-source-id: c8362d6
Pull Request resolved: #83008
#80039

- Remove magic number and assign it to INT64_MAX

[ghstack-poisoned]
#80039

- Remove magic number and assign it to INT64_MAX

[ghstack-poisoned]
@justinchuby

This comment was marked as resolved.

@justinchuby justinchuby changed the title [ONNX] Add quantization support to more ops 1/2 [ONNX] Add quantization support to more single output ops 1/2 Aug 8, 2022
@justinchuby justinchuby changed the title [ONNX] Add quantization support to more single output ops 1/2 [ONNX] Add quantization support to more single output ops Aug 8, 2022
#80039

- Remove magic number and assign it to INT64_MAX

[ghstack-poisoned]
justinchuby added a commit that referenced this pull request Aug 8, 2022
- Remove magic number and assign it to INT64_MAX

ghstack-source-id: a2e5b37
Pull Request resolved: #83008
@justinchuby justinchuby marked this pull request as draft August 9, 2022 19:41
#80039

- Remove magic number and assign it to INT64_MAX

[ghstack-poisoned]
#80039

- Remove magic number and assign it to INT64_MAX

[ghstack-poisoned]
@justinchuby justinchuby linked an issue Aug 18, 2022 that may be closed by this pull request
@justinchuby justinchuby added release notes: onnx torch.onnx related changes that should show up in the release notes module: onnx Related to torch.onnx topic: improvements topic category labels Aug 18, 2022
@BowenBao
Copy link
Collaborator

Please checkout CI failure

#80039

- Implement quantization support for single output ops 
  - quantized::sigmoid
  - quantized::instance_norm
  - aten::reshape
  - aten::reshape_as
  - aten::sum
  - aten::mean
  - aten::prod
  - aten::t
  - aten::numpy_T
  - aten::expand
  - aten::expand_as
  - aten::embedding
  - aten::embedding_bag
  - aten::view
  - aten::select
  - aten::eq
  - aten::ne
  - aten::gt
  - aten::lt
  - aten::le
  - aten::ge
  - quantized::layer_norm
  - aten::elu
  - aten::selu
  - aten::maximum
  - aten::minimum
  - aten::amax
  - aten::amin
  - aten::hardtanh
  - aten::hardswish
  - quantized::group_norm
  - aten::as_strided
  - quantized::leaky_relu
  - aten::transpose
- Avoid modifying functions in `quantized_args` and have the wrapper closed over `scale` and `zero_point` instead (for purity)
- Remove magic number and assign it to INT64_MAX
- implement `_unpack_quantized_tensor` for handling quantized tensor unpacking to separate the logic from tuple unpacking and for clearer error handling

[ghstack-poisoned]
justinchuby added a commit that referenced this pull request Aug 18, 2022
- Remove magic number and assign it to INT64_MAX

ghstack-source-id: f71bcfc
Pull Request resolved: #83008
#80039

- Implement quantization support for single output ops 
  - quantized::sigmoid
  - quantized::instance_norm
  - aten::reshape
  - aten::reshape_as
  - aten::sum
  - aten::mean
  - aten::prod
  - aten::t
  - aten::numpy_T
  - aten::expand
  - aten::expand_as
  - aten::embedding
  - aten::embedding_bag
  - aten::view
  - aten::select
  - aten::eq
  - aten::ne
  - aten::gt
  - aten::lt
  - aten::le
  - aten::ge
  - quantized::layer_norm
  - aten::elu
  - aten::selu
  - aten::maximum
  - aten::minimum
  - aten::amax
  - aten::amin
  - aten::hardtanh
  - aten::hardswish
  - quantized::group_norm
  - aten::as_strided
  - quantized::leaky_relu
  - aten::transpose
- Avoid modifying functions in `quantized_args` and have the wrapper closed over `scale` and `zero_point` instead (for purity)
- Remove magic number and assign it to INT64_MAX
- implement `_unpack_quantized_tensor` for handling quantized tensor unpacking to separate the logic from tuple unpacking and for clearer error handling

[ghstack-poisoned]
#80039

- Implement quantization support for single output ops 
  - quantized::sigmoid
  - quantized::instance_norm
  - aten::reshape
  - aten::reshape_as
  - aten::sum
  - aten::mean
  - aten::prod
  - aten::t
  - aten::numpy_T
  - aten::expand
  - aten::expand_as
  - aten::embedding
  - aten::embedding_bag
  - aten::view
  - aten::select
  - aten::eq
  - aten::ne
  - aten::gt
  - aten::lt
  - aten::le
  - aten::ge
  - quantized::layer_norm
  - aten::elu
  - aten::selu
  - aten::maximum
  - aten::minimum
  - aten::amax
  - aten::amin
  - aten::hardtanh
  - aten::hardswish
  - quantized::group_norm
  - aten::as_strided
  - quantized::leaky_relu
  - aten::transpose
- Avoid modifying functions in `quantized_args` and have the wrapper closed over `scale` and `zero_point` instead (for purity)
- Remove magic number and assign it to INT64_MAX
- implement `_unpack_quantized_tensor` for handling quantized tensor unpacking to separate the logic from tuple unpacking and for clearer error handling

[ghstack-poisoned]
justinchuby added a commit that referenced this pull request Aug 19, 2022
- Remove magic number and assign it to INT64_MAX

ghstack-source-id: 6f0a7be
Pull Request resolved: #83008
#80039

- Implement quantization support for single output ops 
  - quantized::sigmoid
  - quantized::instance_norm
  - aten::reshape
  - aten::reshape_as
  - aten::sum
  - aten::mean
  - aten::prod
  - aten::t
  - aten::numpy_T
  - aten::expand
  - aten::expand_as
  - aten::embedding
  - aten::embedding_bag
  - aten::view
  - aten::select
  - aten::eq
  - aten::ne
  - aten::gt
  - aten::lt
  - aten::le
  - aten::ge
  - quantized::layer_norm
  - aten::elu
  - aten::selu
  - aten::maximum
  - aten::minimum
  - aten::amax
  - aten::amin
  - aten::hardtanh
  - aten::hardswish
  - quantized::group_norm
  - aten::as_strided
  - quantized::leaky_relu
  - aten::transpose
- Avoid modifying functions in `quantized_args` and have the wrapper closed over `scale` and `zero_point` instead (for purity)
- Remove magic number and assign it to INT64_MAX
- implement `_unpack_quantized_tensor` for handling quantized tensor unpacking to separate the logic from tuple unpacking and for clearer error handling

[ghstack-poisoned]
justinchuby added a commit that referenced this pull request Aug 20, 2022
- Remove magic number and assign it to INT64_MAX

ghstack-source-id: 8ac7a21
Pull Request resolved: #83008

Update glu dim
#80039

- Implement quantization support for single output ops 
  - quantized::sigmoid
  - quantized::instance_norm
  - aten::reshape
  - aten::reshape_as
  - aten::sum
  - aten::mean
  - aten::prod
  - aten::t
  - aten::numpy_T
  - aten::expand
  - aten::expand_as
  - aten::embedding
  - aten::embedding_bag
  - aten::view
  - aten::select
  - aten::eq
  - aten::ne
  - aten::gt
  - aten::lt
  - aten::le
  - aten::ge
  - quantized::layer_norm
  - aten::elu
  - aten::selu
  - aten::maximum
  - aten::minimum
  - aten::amax
  - aten::amin
  - aten::hardtanh
  - aten::hardswish
  - quantized::group_norm
  - aten::as_strided
  - quantized::leaky_relu
  - aten::transpose
- Avoid modifying functions in `quantized_args` and have the wrapper closed over `scale` and `zero_point` instead (for purity)
- Remove magic number and assign it to INT64_MAX
- implement `_unpack_quantized_tensor` for handling quantized tensor unpacking to separate the logic from tuple unpacking and for clearer error handling

[ghstack-poisoned]
justinchuby added a commit that referenced this pull request Aug 20, 2022
- Remove magic number and assign it to INT64_MAX

ghstack-source-id: 978af4f
Pull Request resolved: #83008

Update glu dim
@justinchuby
Copy link
Collaborator Author

@BowenBao please take another look

@justinchuby justinchuby requested a review from BowenBao August 22, 2022 18:14
Copy link
Collaborator

@BowenBao BowenBao left a comment

Choose a reason for hiding this comment

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

🚀

@justinchuby
Copy link
Collaborator Author

@pytorchbot merge -g

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a merge job. Check the current status here.
The merge job was triggered with the green (-g) flag. This means that your change will be merged once all checks on your PR have passed (ETA: 0-4 Hours). If this is not the intended behavior, feel free to use some of the other merge options in the wiki.
Please reach out to the PyTorch DevX Team with feedback or questions!

@justinchuby
Copy link
Collaborator Author

@pytorchbot merge -f "All checks passed"

@pytorchmergebot
Copy link
Collaborator

The merge job was canceled. If you believe this is a mistake,then you can re trigger it through pytorch-bot.

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a merge job. Check the current status here.
The merge job was triggered with the force (-f) flag. This means your change will be merged immediately, bypassing any CI checks (ETA: 1-5 minutes). If this is not the intended behavior, feel free to use some of the other merge options in the wiki.
Please reach out to the PyTorch DevX Team with feedback or questions!

facebook-github-bot pushed a commit that referenced this pull request Aug 24, 2022
…83008)

Summary:
#80039

- Implement quantization support for single output ops
  - quantized::sigmoid
  - quantized::instance_norm
  - aten::reshape
  - aten::reshape_as
  - aten::sum
  - aten::mean
  - aten::prod
  - aten::t
  - aten::numpy_T
  - aten::expand
  - aten::expand_as
  - aten::embedding
  - aten::embedding_bag
  - aten::view
  - aten::select
  - aten::eq
  - aten::ne
  - aten::gt
  - aten::lt
  - aten::le
  - aten::ge
  - quantized::layer_norm
  - aten::elu
  - aten::selu
  - aten::maximum
  - aten::minimum
  - aten::amax
  - aten::amin
  - aten::hardtanh
  - aten::hardswish
  - quantized::group_norm
  - aten::as_strided
  - quantized::leaky_relu
  - aten::transpose
- Avoid modifying functions in `quantized_args` and have the wrapper closed over `scale` and `zero_point` instead (for purity)
- Remove magic number and assign it to INT64_MAX
- implement `_unpack_quantized_tensor` for handling quantized tensor unpacking to separate the logic from tuple unpacking and for clearer error handling

Pull Request resolved: #83008
Approved by: https://github.com/BowenBao

Test Plan: contbuild & OSS CI, see https://hud.pytorch.org/commit/pytorch/pytorch/80cfafc3857c981d67507f135232bf43da4a1caa

Reviewed By: weiwangmeta

Differential Revision: D38947052

fbshipit-source-id: 02b0be6c3d27e0a816fc2e97658d119021be3cb1
@facebook-github-bot facebook-github-bot deleted the gh/justinchuby/4/head branch August 26, 2022 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed Merged module: onnx Related to torch.onnx open source release notes: onnx torch.onnx related changes that should show up in the release notes topic: improvements topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Export quantized shufflenet_v2_x0_5 to ONNX [ONNX] Improve quantization error message [ONNX] Increase coverage of quantization operators

5 participants