mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-25 08:11:06 +08:00
treat Parameter the same way as Tensor (#48963)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/48963 This PR makes the binding code treat `Parameter` the same way as `Tensor`, unlike all other `Tensor` subclasses. This does change the semantics of `THPVariable_CheckExact`, but it isn't used much and it seemed to make sense for the half dozen or so places that it is used. Test Plan: Existing unit tests. Benchmarks are in #48966 Reviewed By: ezyang Differential Revision: D25590733 Pulled By: robieta fbshipit-source-id: 060ecaded27b26e4b756898eabb9a94966fc9840
This commit is contained in:
committed by
Facebook GitHub Bot
parent
fd92bcfe39
commit
839c2f235f
@ -334,7 +334,7 @@ void append_overloaded_arg(std::vector<py::handle>* overloaded_args, PyObject* o
|
||||
|
||||
bool is_tensor_and_append_overloaded(PyObject* obj, std::vector<py::handle>* overloaded_args) {
|
||||
if (THPVariable_CheckExact(obj)) {
|
||||
// torch.Tensor instances (not subclasses)
|
||||
// torch.Tensor instances (not subclasses, except for Parameter)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user