mirror of
https://github.com/pytorch/pytorch.git
synced 2026-11-20 09:04:25 +08:00
Make autogen functions correct for multiple outputs and views (#31990)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/31990 This PR does three things: - Add a new `allow_rebase_history` flag to the differentiable views. If set, trying to rebase their history will raise an error. - Make sure that the codegen functions verify this flag before doing inplace operations so that they fail before doing the inplace modification. - Make sure the codegen functions set this flag properly when we don't support rebasing the history of the output. The codegen change can be found [here](https://github.com/pytorch/pytorch/commit/4bf180caa0e655111b036c8b0419da89fc75671b). Test Plan: Imported from OSS Differential Revision: D19409649 Pulled By: albanD fbshipit-source-id: a2b41c2d231e952ecfe162bdb6bad620ac595703
This commit is contained in:
committed by
Facebook Github Bot
parent
9e59244b53
commit
3ab30753e9
@@ -105,7 +105,7 @@ TEST(InitTest, CanInitializeTensorThatRequiresGrad) {
|
||||
ASSERT_THROWS_WITH(
|
||||
tensor.fill_(1),
|
||||
"a leaf Variable that requires grad "
|
||||
"has been used in an in-place operation");
|
||||
"is being used in an in-place operation");
|
||||
ASSERT_EQ(torch::nn::init::ones_(tensor).sum().item<int32_t>(), 12);
|
||||
}
|
||||
|
||||
@@ -168,4 +168,4 @@ TEST(InitTest, FanModeLegacyEnum) {
|
||||
|
||||
FANMODE_ENUM_LEGACY_WARNING_CHECK(kaiming_uniform_, FanIn, "torch::kFanIn")
|
||||
FANMODE_ENUM_LEGACY_WARNING_CHECK(kaiming_uniform_, FanOut, "torch::kFanOut")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user