KEMBAR78
Add permute_duplicate_pooled_embeddings op by AGZain · Pull Request #1912 · pytorch/FBGEMM · GitHub
Skip to content

Conversation

@AGZain
Copy link
Contributor

@AGZain AGZain commented Aug 5, 2023

Summary:

Background

Currently permute_pooled_embs_gpu does not support duplicates in a permutation, this poses a problem with passing the same embeddings to multiple modules. This doc proposes a solution to allow duplicate subsets in the resultant permutation.

Details

The required implementation of permute_duplicate_pooled_embs_gpu should support a subset being repeated. This is represented by having duplicates in the permute list. This also results in the output list size being greater than the input list.

Input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Offset_dims: [0, 2, 5, 6, 10]
Permute: [3, 0, 2, 1, 3]

Output: [6, 7, 8, 9, 0, 1, 5, 2, 3, 4, 6, 7, 8, 9]

Backwards Compatibility

The permute_duplicate_pooled_embs_gpu is backwards compatible with the permute_pooled_embs_gpu (non duplicate permutations) use case, hence any use of permute_pooled_embs_gpu in the inference path can be replaced with permute_duplicate_pooled_embs_gpu.

Documentation

Link

Differential Revision: D48090591

@netlify
Copy link

netlify bot commented Aug 5, 2023

Deploy Preview for pytorch-fbgemm-docs canceled.

Name Link
🔨 Latest commit ab8791d
🔍 Latest deploy log https://app.netlify.com/sites/pytorch-fbgemm-docs/deploys/64e618605d43fb0007a73436

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48090591

AGZain added a commit to AGZain/FBGEMM that referenced this pull request Aug 5, 2023
Summary:
Pull Request resolved: pytorch#1912

# Background
Currently permute_pooled_embs_gpu does not support duplicates in a permutation, this poses a problem with passing the same embeddings to multiple modules. This doc proposes a solution to allow duplicate subsets in the resultant permutation.

# Details
The required implementation of permute_duplicate_pooled_embs_gpu should support a subset being repeated. This is represented by having duplicates in the permute list. This also results in the output list size being greater than the input list.

Input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Offset_dims: [0,  2,  5,  6, 10]
Permute: [3, 0, 2, 1, 3]

Output:  [6, 7, 8, 9, 0, 1, 5, 2, 3, 4, 6, 7, 8, 9]

# Backwards Compatibility
The permute_duplicate_pooled_embs_gpu is backwards compatible with the permute_pooled_embs_gpu (non duplicate permutations) use case, hence any use of permute_pooled_embs_gpu in the inference path can be replaced with permute_duplicate_pooled_embs_gpu.

# Documentation
[Link](https://docs.google.com/document/d/1rp31nhcRuVmh8RVbWcktL3Hq-0ccc84AYL4nVegDywI)

Differential Revision: D48090591

fbshipit-source-id: a398bc495e3461abc429974dc6d2212e0178e59d
@AGZain AGZain force-pushed the export-D48090591 branch from 8f33247 to 1a13a72 Compare August 5, 2023 05:36
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48090591

AGZain added a commit to AGZain/FBGEMM that referenced this pull request Aug 5, 2023
Summary:
Pull Request resolved: pytorch#1912

# Background
Currently permute_pooled_embs_gpu does not support duplicates in a permutation, this poses a problem with passing the same embeddings to multiple modules. This doc proposes a solution to allow duplicate subsets in the resultant permutation.

# Details
The required implementation of permute_duplicate_pooled_embs_gpu should support a subset being repeated. This is represented by having duplicates in the permute list. This also results in the output list size being greater than the input list.

Input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Offset_dims: [0,  2,  5,  6, 10]
Permute: [3, 0, 2, 1, 3]

Output:  [6, 7, 8, 9, 0, 1, 5, 2, 3, 4, 6, 7, 8, 9]

# Backwards Compatibility
The permute_duplicate_pooled_embs_gpu is backwards compatible with the permute_pooled_embs_gpu (non duplicate permutations) use case, hence any use of permute_pooled_embs_gpu in the inference path can be replaced with permute_duplicate_pooled_embs_gpu.

# Documentation
[Link](https://docs.google.com/document/d/1rp31nhcRuVmh8RVbWcktL3Hq-0ccc84AYL4nVegDywI)

Differential Revision: D48090591

fbshipit-source-id: 99a9d88a2f1ada30dd41c24b4df97745c5e108d8
@AGZain AGZain force-pushed the export-D48090591 branch from 1a13a72 to 29835eb Compare August 5, 2023 05:42
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48090591

AGZain added a commit to AGZain/FBGEMM that referenced this pull request Aug 7, 2023
Summary:
Pull Request resolved: pytorch#1912

# Background
Currently permute_pooled_embs_gpu does not support duplicates in a permutation, this poses a problem with passing the same embeddings to multiple modules. This doc proposes a solution to allow duplicate subsets in the resultant permutation.

# Details
The required implementation of permute_duplicate_pooled_embs_gpu should support a subset being repeated. This is represented by having duplicates in the permute list. This also results in the output list size being greater than the input list.

Input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Offset_dims: [0,  2,  5,  6, 10]
Permute: [3, 0, 2, 1, 3]

Output:  [6, 7, 8, 9, 0, 1, 5, 2, 3, 4, 6, 7, 8, 9]

# Backwards Compatibility
The permute_duplicate_pooled_embs_gpu is backwards compatible with the permute_pooled_embs_gpu (non duplicate permutations) use case, hence any use of permute_pooled_embs_gpu in the inference path can be replaced with permute_duplicate_pooled_embs_gpu.

# Documentation
[Link](https://docs.google.com/document/d/1rp31nhcRuVmh8RVbWcktL3Hq-0ccc84AYL4nVegDywI)

Differential Revision: D48090591

fbshipit-source-id: 9ca8cfa7b066c84d20e3618b073bcd66627c32ee
@AGZain AGZain force-pushed the export-D48090591 branch from 29835eb to ed253e2 Compare August 7, 2023 05:43
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48090591

AGZain added a commit to AGZain/FBGEMM that referenced this pull request Aug 7, 2023
Summary:
Pull Request resolved: pytorch#1912

# Background
Currently permute_pooled_embs_gpu does not support duplicates in a permutation, this poses a problem with passing the same embeddings to multiple modules. This doc proposes a solution to allow duplicate subsets in the resultant permutation.

# Details
The required implementation of permute_duplicate_pooled_embs_gpu should support a subset being repeated. This is represented by having duplicates in the permute list. This also results in the output list size being greater than the input list.

Input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Offset_dims: [0,  2,  5,  6, 10]
Permute: [3, 0, 2, 1, 3]

Output:  [6, 7, 8, 9, 0, 1, 5, 2, 3, 4, 6, 7, 8, 9]

# Backwards Compatibility
The permute_duplicate_pooled_embs_gpu is backwards compatible with the permute_pooled_embs_gpu (non duplicate permutations) use case, hence any use of permute_pooled_embs_gpu in the inference path can be replaced with permute_duplicate_pooled_embs_gpu.

# Documentation
[Link](https://docs.google.com/document/d/1rp31nhcRuVmh8RVbWcktL3Hq-0ccc84AYL4nVegDywI)

Differential Revision: D48090591

fbshipit-source-id: 03f3792cc2309e5dae5af4532887e29ce0e07cd4
@AGZain AGZain force-pushed the export-D48090591 branch from ed253e2 to a1132db Compare August 7, 2023 05:49
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48090591

AGZain added a commit to AGZain/FBGEMM that referenced this pull request Aug 7, 2023
Summary:
Pull Request resolved: pytorch#1912

# Background
Currently permute_pooled_embs_gpu does not support duplicates in a permutation, this poses a problem with passing the same embeddings to multiple modules. This doc proposes a solution to allow duplicate subsets in the resultant permutation.

# Details
The required implementation of permute_duplicate_pooled_embs_gpu should support a subset being repeated. This is represented by having duplicates in the permute list. This also results in the output list size being greater than the input list.

Input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Offset_dims: [0,  2,  5,  6, 10]
Permute: [3, 0, 2, 1, 3]

Output:  [6, 7, 8, 9, 0, 1, 5, 2, 3, 4, 6, 7, 8, 9]

# Backwards Compatibility
The permute_duplicate_pooled_embs_gpu is backwards compatible with the permute_pooled_embs_gpu (non duplicate permutations) use case, hence any use of permute_pooled_embs_gpu in the inference path can be replaced with permute_duplicate_pooled_embs_gpu.

# Documentation
[Link](https://docs.google.com/document/d/1rp31nhcRuVmh8RVbWcktL3Hq-0ccc84AYL4nVegDywI)

Differential Revision: D48090591

fbshipit-source-id: e66734ca9e6e105dbe0031025239ae585063c255
@AGZain AGZain force-pushed the export-D48090591 branch from a1132db to a9dd610 Compare August 7, 2023 05:54
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48090591

1 similar comment
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48090591

AGZain added a commit to AGZain/FBGEMM that referenced this pull request Aug 11, 2023
Summary:
Pull Request resolved: pytorch#1912

# Background
Currently permute_pooled_embs_gpu does not support duplicates in a permutation, this poses a problem with passing the same embeddings to multiple modules. This doc proposes a solution to allow duplicate subsets in the resultant permutation.

# Details
The required implementation of permute_duplicate_pooled_embs_gpu should support a subset being repeated. This is represented by having duplicates in the permute list. This also results in the output list size being greater than the input list.

Input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Offset_dims: [0,  2,  5,  6, 10]
Permute: [3, 0, 2, 1, 3]

Output:  [6, 7, 8, 9, 0, 1, 5, 2, 3, 4, 6, 7, 8, 9]

# Backwards Compatibility
The permute_duplicate_pooled_embs_gpu is backwards compatible with the permute_pooled_embs_gpu (non duplicate permutations) use case, hence any use of permute_pooled_embs_gpu in the inference path can be replaced with permute_duplicate_pooled_embs_gpu.

# Documentation
[Link](https://docs.google.com/document/d/1rp31nhcRuVmh8RVbWcktL3Hq-0ccc84AYL4nVegDywI)

Differential Revision: D48090591

fbshipit-source-id: 922e8c472c3ffb42f23c36dd38c67a3dffa8e119
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48090591

AGZain added a commit to AGZain/FBGEMM that referenced this pull request Aug 14, 2023
Summary:
Pull Request resolved: pytorch#1912

# Background
Currently permute_pooled_embs_gpu does not support duplicates in a permutation, this poses a problem with passing the same embeddings to multiple modules. This doc proposes a solution to allow duplicate subsets in the resultant permutation.

# Details
The required implementation of permute_duplicate_pooled_embs_gpu should support a subset being repeated. This is represented by having duplicates in the permute list. This also results in the output list size being greater than the input list.

Input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Offset_dims: [0,  2,  5,  6, 10]
Permute: [3, 0, 2, 1, 3]

Output:  [6, 7, 8, 9, 0, 1, 5, 2, 3, 4, 6, 7, 8, 9]

# Backwards Compatibility
The permute_duplicate_pooled_embs_gpu is backwards compatible with the permute_pooled_embs_gpu (non duplicate permutations) use case, hence any use of permute_pooled_embs_gpu in the inference path can be replaced with permute_duplicate_pooled_embs_gpu.

# Documentation
[Link](https://docs.google.com/document/d/1rp31nhcRuVmh8RVbWcktL3Hq-0ccc84AYL4nVegDywI)

Differential Revision: D48090591

fbshipit-source-id: 96edf038b8c991b0331e05a0ec5a84d9e35bcf91
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48090591

AGZain added a commit to AGZain/FBGEMM that referenced this pull request Aug 14, 2023
Summary:
Pull Request resolved: pytorch#1912

# Background
Currently permute_pooled_embs_gpu does not support duplicates in a permutation, this poses a problem with passing the same embeddings to multiple modules. This doc proposes a solution to allow duplicate subsets in the resultant permutation.

# Details
The required implementation of permute_duplicate_pooled_embs_gpu should support a subset being repeated. This is represented by having duplicates in the permute list. This also results in the output list size being greater than the input list.

Input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Offset_dims: [0,  2,  5,  6, 10]
Permute: [3, 0, 2, 1, 3]

Output:  [6, 7, 8, 9, 0, 1, 5, 2, 3, 4, 6, 7, 8, 9]

# Backwards Compatibility
The permute_duplicate_pooled_embs_gpu is backwards compatible with the permute_pooled_embs_gpu (non duplicate permutations) use case, hence any use of permute_pooled_embs_gpu in the inference path can be replaced with permute_duplicate_pooled_embs_gpu.

# Documentation
[Link](https://docs.google.com/document/d/1rp31nhcRuVmh8RVbWcktL3Hq-0ccc84AYL4nVegDywI)

Differential Revision: D48090591

fbshipit-source-id: f8dd2cce92b768c2c1269d071d32fa795e6bf29e
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48090591

AGZain added a commit to AGZain/FBGEMM that referenced this pull request Aug 14, 2023
Summary:
Pull Request resolved: pytorch#1912

# Background
Currently permute_pooled_embs_gpu does not support duplicates in a permutation, this poses a problem with passing the same embeddings to multiple modules. This doc proposes a solution to allow duplicate subsets in the resultant permutation.

# Details
The required implementation of permute_duplicate_pooled_embs_gpu should support a subset being repeated. This is represented by having duplicates in the permute list. This also results in the output list size being greater than the input list.

Input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Offset_dims: [0,  2,  5,  6, 10]
Permute: [3, 0, 2, 1, 3]

Output:  [6, 7, 8, 9, 0, 1, 5, 2, 3, 4, 6, 7, 8, 9]

# Backwards Compatibility
The permute_duplicate_pooled_embs_gpu is backwards compatible with the permute_pooled_embs_gpu (non duplicate permutations) use case, hence any use of permute_pooled_embs_gpu in the inference path can be replaced with permute_duplicate_pooled_embs_gpu.

# Documentation
[Link](https://docs.google.com/document/d/1rp31nhcRuVmh8RVbWcktL3Hq-0ccc84AYL4nVegDywI)

Differential Revision: D48090591

fbshipit-source-id: 87fbb41662af0c8bb6cba0b6ecc8aa6f06b3d30c
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48090591

AGZain added a commit to AGZain/FBGEMM that referenced this pull request Aug 18, 2023
Summary:
Pull Request resolved: pytorch#1912

# Background
Currently permute_pooled_embs_gpu does not support duplicates in a permutation, this poses a problem with passing the same embeddings to multiple modules. This doc proposes a solution to allow duplicate subsets in the resultant permutation.

# Details
The required implementation of permute_duplicate_pooled_embs_gpu should support a subset being repeated. This is represented by having duplicates in the permute list. This also results in the output list size being greater than the input list.

Input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Offset_dims: [0,  2,  5,  6, 10]
Permute: [3, 0, 2, 1, 3]

Output:  [6, 7, 8, 9, 0, 1, 5, 2, 3, 4, 6, 7, 8, 9]

# Backwards Compatibility
The permute_duplicate_pooled_embs_gpu is backwards compatible with the permute_pooled_embs_gpu (non duplicate permutations) use case, hence any use of permute_pooled_embs_gpu in the inference path can be replaced with permute_duplicate_pooled_embs_gpu.

# Documentation
[Link](https://docs.google.com/document/d/1rp31nhcRuVmh8RVbWcktL3Hq-0ccc84AYL4nVegDywI)

Differential Revision: D48090591

fbshipit-source-id: daa9b037786e44123afad875b05ab68792fbd2ab
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48090591

AGZain added a commit to AGZain/FBGEMM that referenced this pull request Aug 18, 2023
Summary:
Pull Request resolved: pytorch#1912

# Background
Currently permute_pooled_embs_gpu does not support duplicates in a permutation, this poses a problem with passing the same embeddings to multiple modules. This doc proposes a solution to allow duplicate subsets in the resultant permutation.

# Details
The required implementation of permute_duplicate_pooled_embs_gpu should support a subset being repeated. This is represented by having duplicates in the permute list. This also results in the output list size being greater than the input list.

Input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Offset_dims: [0,  2,  5,  6, 10]
Permute: [3, 0, 2, 1, 3]

Output:  [6, 7, 8, 9, 0, 1, 5, 2, 3, 4, 6, 7, 8, 9]

# Backwards Compatibility
The permute_duplicate_pooled_embs_gpu is backwards compatible with the permute_pooled_embs_gpu (non duplicate permutations) use case, hence any use of permute_pooled_embs_gpu in the inference path can be replaced with permute_duplicate_pooled_embs_gpu.

# Documentation
[Link](https://docs.google.com/document/d/1rp31nhcRuVmh8RVbWcktL3Hq-0ccc84AYL4nVegDywI)

Reviewed By: sryap

Differential Revision: D48090591

fbshipit-source-id: e649a33d6b5ff70733e37bd96e9419328c3c0624
AGZain added a commit to AGZain/FBGEMM that referenced this pull request Aug 21, 2023
Summary:
Pull Request resolved: pytorch#1912

# Background
Currently permute_pooled_embs_gpu does not support duplicates in a permutation, this poses a problem with passing the same embeddings to multiple modules. This doc proposes a solution to allow duplicate subsets in the resultant permutation.

# Details
The required implementation of permute_duplicate_pooled_embs_gpu should support a subset being repeated. This is represented by having duplicates in the permute list. This also results in the output list size being greater than the input list.

Input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Offset_dims: [0,  2,  5,  6, 10]
Permute: [3, 0, 2, 1, 3]

Output:  [6, 7, 8, 9, 0, 1, 5, 2, 3, 4, 6, 7, 8, 9]

# Backwards Compatibility
The permute_duplicate_pooled_embs_gpu is backwards compatible with the permute_pooled_embs_gpu (non duplicate permutations) use case, hence any use of permute_pooled_embs_gpu in the inference path can be replaced with permute_duplicate_pooled_embs_gpu.

# Documentation
[Link](https://docs.google.com/document/d/1rp31nhcRuVmh8RVbWcktL3Hq-0ccc84AYL4nVegDywI)

Reviewed By: sryap

Differential Revision: D48090591

fbshipit-source-id: e12c85ab1ce9066a8cc4eb7bd29759d5c4a5be6c
AGZain added a commit to AGZain/FBGEMM that referenced this pull request Aug 21, 2023
Summary:
Pull Request resolved: pytorch#1912

# Background
Currently permute_pooled_embs_gpu does not support duplicates in a permutation, this poses a problem with passing the same embeddings to multiple modules. This doc proposes a solution to allow duplicate subsets in the resultant permutation.

# Details
The required implementation of permute_duplicate_pooled_embs_gpu should support a subset being repeated. This is represented by having duplicates in the permute list. This also results in the output list size being greater than the input list.

Input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Offset_dims: [0,  2,  5,  6, 10]
Permute: [3, 0, 2, 1, 3]

Output:  [6, 7, 8, 9, 0, 1, 5, 2, 3, 4, 6, 7, 8, 9]

# Backwards Compatibility
The permute_duplicate_pooled_embs_gpu is backwards compatible with the permute_pooled_embs_gpu (non duplicate permutations) use case, hence any use of permute_pooled_embs_gpu in the inference path can be replaced with permute_duplicate_pooled_embs_gpu.

# Documentation
[Link](https://docs.google.com/document/d/1rp31nhcRuVmh8RVbWcktL3Hq-0ccc84AYL4nVegDywI)

Reviewed By: sryap

Differential Revision: D48090591

fbshipit-source-id: d484cd779edb37f9c3a4bb0af1725aa7960c03cd
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48090591

AGZain added a commit to AGZain/FBGEMM that referenced this pull request Aug 22, 2023
Summary:
Pull Request resolved: pytorch#1912

# Background
Currently permute_pooled_embs_gpu does not support duplicates in a permutation, this poses a problem with passing the same embeddings to multiple modules. This doc proposes a solution to allow duplicate subsets in the resultant permutation.

# Details
The required implementation of permute_duplicate_pooled_embs_gpu should support a subset being repeated. This is represented by having duplicates in the permute list. This also results in the output list size being greater than the input list.

Input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Offset_dims: [0,  2,  5,  6, 10]
Permute: [3, 0, 2, 1, 3]

Output:  [6, 7, 8, 9, 0, 1, 5, 2, 3, 4, 6, 7, 8, 9]

# Backwards Compatibility
The permute_duplicate_pooled_embs_gpu is backwards compatible with the permute_pooled_embs_gpu (non duplicate permutations) use case, hence any use of permute_pooled_embs_gpu in the inference path can be replaced with permute_duplicate_pooled_embs_gpu.

# Documentation
[Link](https://docs.google.com/document/d/1rp31nhcRuVmh8RVbWcktL3Hq-0ccc84AYL4nVegDywI)

Reviewed By: sryap

Differential Revision: D48090591

fbshipit-source-id: 083b519187afdb7ae9a75be68c7e5725b6968194
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48090591

AGZain added a commit to AGZain/FBGEMM that referenced this pull request Aug 22, 2023
Summary:
Pull Request resolved: pytorch#1912

# Background
Currently permute_pooled_embs_gpu does not support duplicates in a permutation, this poses a problem with passing the same embeddings to multiple modules. This doc proposes a solution to allow duplicate subsets in the resultant permutation.

# Details
The required implementation of permute_duplicate_pooled_embs_gpu should support a subset being repeated. This is represented by having duplicates in the permute list. This also results in the output list size being greater than the input list.

Input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Offset_dims: [0,  2,  5,  6, 10]
Permute: [3, 0, 2, 1, 3]

Output:  [6, 7, 8, 9, 0, 1, 5, 2, 3, 4, 6, 7, 8, 9]

# Backwards Compatibility
The permute_duplicate_pooled_embs_gpu is backwards compatible with the permute_pooled_embs_gpu (non duplicate permutations) use case, hence any use of permute_pooled_embs_gpu in the inference path can be replaced with permute_duplicate_pooled_embs_gpu.

# Documentation
[Link](https://docs.google.com/document/d/1rp31nhcRuVmh8RVbWcktL3Hq-0ccc84AYL4nVegDywI)

Reviewed By: sryap

Differential Revision: D48090591

fbshipit-source-id: bb202c905728d01171a642ae0722d0aa97f25af7
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48090591

AGZain added a commit to AGZain/FBGEMM that referenced this pull request Aug 22, 2023
Summary:
Pull Request resolved: pytorch#1912

# Background
Currently permute_pooled_embs_gpu does not support duplicates in a permutation, this poses a problem with passing the same embeddings to multiple modules. This doc proposes a solution to allow duplicate subsets in the resultant permutation.

# Details
The required implementation of permute_duplicate_pooled_embs_gpu should support a subset being repeated. This is represented by having duplicates in the permute list. This also results in the output list size being greater than the input list.

Input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Offset_dims: [0,  2,  5,  6, 10]
Permute: [3, 0, 2, 1, 3]

Output:  [6, 7, 8, 9, 0, 1, 5, 2, 3, 4, 6, 7, 8, 9]

# Backwards Compatibility
The permute_duplicate_pooled_embs_gpu is backwards compatible with the permute_pooled_embs_gpu (non duplicate permutations) use case, hence any use of permute_pooled_embs_gpu in the inference path can be replaced with permute_duplicate_pooled_embs_gpu.

# Documentation
[Link](https://docs.google.com/document/d/1rp31nhcRuVmh8RVbWcktL3Hq-0ccc84AYL4nVegDywI)

Reviewed By: sryap

Differential Revision: D48090591

fbshipit-source-id: 4096408033988ab17e0ca3c76a661e4bce6d8fde
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48090591

AGZain added a commit to AGZain/FBGEMM that referenced this pull request Aug 23, 2023
Summary:
Pull Request resolved: pytorch#1912

# Background
Currently permute_pooled_embs_gpu does not support duplicates in a permutation, this poses a problem with passing the same embeddings to multiple modules. This doc proposes a solution to allow duplicate subsets in the resultant permutation.

# Details
The required implementation of permute_duplicate_pooled_embs_gpu should support a subset being repeated. This is represented by having duplicates in the permute list. This also results in the output list size being greater than the input list.

Input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Offset_dims: [0,  2,  5,  6, 10]
Permute: [3, 0, 2, 1, 3]

Output:  [6, 7, 8, 9, 0, 1, 5, 2, 3, 4, 6, 7, 8, 9]

# Backwards Compatibility
The permute_duplicate_pooled_embs_gpu is backwards compatible with the permute_pooled_embs_gpu (non duplicate permutations) use case, hence any use of permute_pooled_embs_gpu in the inference path can be replaced with permute_duplicate_pooled_embs_gpu.

# Documentation
[Link](https://docs.google.com/document/d/1rp31nhcRuVmh8RVbWcktL3Hq-0ccc84AYL4nVegDywI)

Reviewed By: sryap

Differential Revision: D48090591

fbshipit-source-id: ebb5a15ae0a5cf9b0b03b6b5be78360838e05849
Summary:
Pull Request resolved: pytorch#1912

# Background
Currently permute_pooled_embs_gpu does not support duplicates in a permutation, this poses a problem with passing the same embeddings to multiple modules. This doc proposes a solution to allow duplicate subsets in the resultant permutation.

# Details
The required implementation of permute_duplicate_pooled_embs_gpu should support a subset being repeated. This is represented by having duplicates in the permute list. This also results in the output list size being greater than the input list.

Input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Offset_dims: [0,  2,  5,  6, 10]
Permute: [3, 0, 2, 1, 3]

Output:  [6, 7, 8, 9, 0, 1, 5, 2, 3, 4, 6, 7, 8, 9]

# Backwards Compatibility
The permute_duplicate_pooled_embs_gpu is backwards compatible with the permute_pooled_embs_gpu (non duplicate permutations) use case, hence any use of permute_pooled_embs_gpu in the inference path can be replaced with permute_duplicate_pooled_embs_gpu.

# Documentation
[Link](https://docs.google.com/document/d/1rp31nhcRuVmh8RVbWcktL3Hq-0ccc84AYL4nVegDywI)

Reviewed By: sryap

Differential Revision: D48090591

fbshipit-source-id: 54fce7365a7608a175b0eb0de9484a829fe2cd34
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48090591

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 9d221b7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants