[JIT] Modify is_mutable in FunctionSchema and SchemaInfo to have SchemaArgument parameter instead of index (#81784)

- Modify the is_mutable(size_t index) overload to become is_mutable(const SchemaArgument& argument) due to cases where one might want to check the mutability of either input or output arguments.
- Refactored all calls to the function to use this new overload
- Tested through is_mutable() tests in test_schema_info.cpp
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81784
Approved by: https://github.com/davidberard98
This commit is contained in:
goldenxuett
2022-07-20 11:01:39 -07:00
committed by PyTorch MergeBot
parent 41d054ab11
commit c9497886fd
7 changed files with 40 additions and 29 deletions

View File

@ -1676,7 +1676,9 @@ void initJITBindings(PyObject* module) {
.def("is_mutable", [](SchemaInfo& self) { return self.is_mutable(); })
.def(
"is_mutable",
[](SchemaInfo& self, size_t index) { return self.is_mutable(index); })
[](SchemaInfo& self, const SchemaArgument& argument) {
return self.is_mutable(argument);
})
.def(
"is_mutable",
[](SchemaInfo& self, const std::string& name) {