Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support Kwargs in C++ Function/Method calls#19086

Closed
zdevito wants to merge 15 commits into
gh/zdevito/13/basefrom
gh/zdevito/13/head
Closed

Support Kwargs in C++ Function/Method calls#19086
zdevito wants to merge 15 commits into
gh/zdevito/13/basefrom
gh/zdevito/13/head

Conversation

@zdevito
Copy link
Copy Markdown
Contributor

@zdevito zdevito commented Apr 9, 2019

Stack from ghstack:

Summary: Adds a Kwargs optional argument to the operator() for Method
and Function. Refactors logic from the python support for kwargs so
that it can be shared

Test Plan: test_jit.py TestJit.test_cpp

Differential Revision: D14875729

Summary: Adds a Kwargs optional argument to the operator() for Method
and Function. Refactors logic from the python support for kwargs so
that it can be shared

Test Plan: test_jit.py TestJit.test_cpp
@facebook-github-bot facebook-github-bot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Apr 9, 2019
zdevito added 4 commits April 9, 2019 16:30
Support Kwargs in C++ Function/Method calls

Summary: Adds a Kwargs optional argument to the operator() for Method
and Function. Refactors logic from the python support for kwargs so
that it can be shared

Test Plan: test_jit.py TestJit.test_cpp

gh-metadata: pytorch pytorch 19086 gh/zdevito/13/head
Support Kwargs in C++ Function/Method calls

Summary: Adds a Kwargs optional argument to the operator() for Method
and Function. Refactors logic from the python support for kwargs so
that it can be shared

Test Plan: test_jit.py TestJit.test_cpp

gh-metadata: pytorch pytorch 19086 gh/zdevito/13/head
Support Kwargs in C++ Function/Method calls

Summary: Adds a Kwargs optional argument to the operator() for Method
and Function. Refactors logic from the python support for kwargs so
that it can be shared

Test Plan: test_jit.py TestJit.test_cpp

gh-metadata: pytorch pytorch 19086 gh/zdevito/13/head
Support Kwargs in C++ Function/Method calls

Summary: Adds a Kwargs optional argument to the operator() for Method
and Function. Refactors logic from the python support for kwargs so
that it can be shared

Test Plan: test_jit.py TestJit.test_cpp

gh-metadata: pytorch pytorch 19086 gh/zdevito/13/head
Support Kwargs in C++ Function/Method calls

Summary: Adds a Kwargs optional argument to the operator() for Method
and Function. Refactors logic from the python support for kwargs so
that it can be shared

Test Plan: test_jit.py TestJit.test_cpp

gh-metadata: pytorch pytorch 19086 gh/zdevito/13/head
Copy link
Copy Markdown

@ZolotukhinM ZolotukhinM left a comment

Choose a reason for hiding this comment

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

Looks good!

void FunctionSchema::findErrorInKwargs(const std::vector<std::string>& kwargs) const {
// First check if any of the kwargs are unknown, i.e. don't match the name of
// any argument in the schema.
for (const auto& kwarg : kwargs) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why not std::find like in the loop below? Also, I wonder if it's worth putting both arguments and kwargs into an unordered_set.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it needs to be a lambda variant because it is matching argument.name against kwarg. Not sure why it was count_if rather than find_if, I moved it from another file...

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Let's keep it as-is since it's just a move then. We can consider cleaning it up later.

Comment thread aten/src/ATen/core/function_schema.cpp Outdated
}
}

void FunctionSchema::checkAndNormalizeInputs(std::vector<IValue>& inputs, const std::unordered_map<std::string, IValue> & kwargs) const {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Clang-format please :)

Support Kwargs in C++ Function/Method calls

Summary: Adds a Kwargs optional argument to the operator() for Method
and Function. Refactors logic from the python support for kwargs so
that it can be shared

Test Plan: test_jit.py TestJit.test_cpp

gh-metadata: pytorch pytorch 19086 gh/zdevito/13/head
@zdevito zdevito removed the request for review from suo April 11, 2019 00:18
zdevito added 2 commits April 10, 2019 17:21
Support Kwargs in C++ Function/Method calls

Summary: Adds a Kwargs optional argument to the operator() for Method
and Function. Refactors logic from the python support for kwargs so
that it can be shared

Test Plan: test_jit.py TestJit.test_cpp

gh-metadata: pytorch pytorch 19086 gh/zdevito/13/head
Support Kwargs in C++ Function/Method calls

Summary: Adds a Kwargs optional argument to the operator() for Method
and Function. Refactors logic from the python support for kwargs so
that it can be shared

Test Plan: test_jit.py TestJit.test_cpp

gh-metadata: pytorch pytorch 19086 gh/zdevito/13/head
zdevito added 4 commits April 10, 2019 19:48
Support Kwargs in C++ Function/Method calls

Summary: Adds a Kwargs optional argument to the operator() for Method
and Function. Refactors logic from the python support for kwargs so
that it can be shared

Test Plan: test_jit.py TestJit.test_cpp

gh-metadata: pytorch pytorch 19086 gh/zdevito/13/head
Support Kwargs in C++ Function/Method calls

Summary: Adds a Kwargs optional argument to the operator() for Method
and Function. Refactors logic from the python support for kwargs so
that it can be shared

Test Plan: test_jit.py TestJit.test_cpp

gh-metadata: pytorch pytorch 19086 gh/zdevito/13/head
Support Kwargs in C++ Function/Method calls

Summary: Adds a Kwargs optional argument to the operator() for Method
and Function. Refactors logic from the python support for kwargs so
that it can be shared

Test Plan: test_jit.py TestJit.test_cpp

gh-metadata: pytorch pytorch 19086 gh/zdevito/13/head
Support Kwargs in C++ Function/Method calls

Summary: Adds a Kwargs optional argument to the operator() for Method
and Function. Refactors logic from the python support for kwargs so
that it can be shared

Test Plan: test_jit.py TestJit.test_cpp

gh-metadata: pytorch pytorch 19086 gh/zdevito/13/head
zdevito added 2 commits April 12, 2019 14:28
Support Kwargs in C++ Function/Method calls

Summary: Adds a Kwargs optional argument to the operator() for Method
and Function. Refactors logic from the python support for kwargs so
that it can be shared

Test Plan: test_jit.py TestJit.test_cpp

gh-metadata: pytorch pytorch 19086 gh/zdevito/13/head
Support Kwargs in C++ Function/Method calls

Summary: Adds a Kwargs optional argument to the operator() for Method
and Function. Refactors logic from the python support for kwargs so
that it can be shared

Test Plan: test_jit.py TestJit.test_cpp

gh-metadata: pytorch pytorch 19086 gh/zdevito/13/head
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@zdevito merged this pull request in c38c7b0.

zdevito added a commit to zdevito/ATen that referenced this pull request Apr 13, 2019
Summary:
Pull Request resolved: pytorch/pytorch#19086
ghimport-source-id: 7790a5cc6e32f6f72e92add0b9f76dfa49ad9859

Reviewed By: jamesr66a

Differential Revision: D14875729

Pulled By: zdevito

fbshipit-source-id: ad1e4542381d9c33722155459e794f1ba4660dbb
zhangguanheng66 pushed a commit to zhangguanheng66/pytorch that referenced this pull request May 6, 2019
Summary:
Pull Request resolved: pytorch#19086
ghimport-source-id: 7790a5c

Reviewed By: jamesr66a

Differential Revision: D14875729

Pulled By: zdevito

fbshipit-source-id: ad1e4542381d9c33722155459e794f1ba4660dbb
@ezyang ezyang deleted the gh/zdevito/13/head branch May 30, 2019 15:20
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
Summary:
Pull Request resolved: pytorch#19086
ghimport-source-id: 7790a5c

Reviewed By: jamesr66a

Differential Revision: D14875729

Pulled By: zdevito

fbshipit-source-id: ad1e4542381d9c33722155459e794f1ba4660dbb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

oncall: jit Add this issue/PR to JIT oncall triage queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants