mirror of
https://github.com/pytorch/pytorch.git
synced 2026-11-20 09:04:25 +08:00
Change to.dtype_layout to c10-full (#41169)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/41169 - ghstack-source-id: 107537240 Test Plan: waitforsandcastle Differential Revision: D22289257 fbshipit-source-id: ed3cc06327951fa886eb3b8f1c8bcc014ae2bc41
This commit is contained in:
committed by
Facebook GitHub Bot
parent
7c143e5d3e
commit
9daba76ba1
@@ -99,8 +99,10 @@ TEST(TensorTest, ToOptionsWithRequiresGrad) {
|
||||
// Throws if requires_grad is set in TensorOptions
|
||||
ASSERT_THROW(
|
||||
tensor.to(at::TensorOptions().requires_grad(true)), c10::Error);
|
||||
ASSERT_THROW(
|
||||
tensor.to(at::TensorOptions().requires_grad(false)), c10::Error);
|
||||
|
||||
// Doesn't throw if requires_grad is not set
|
||||
tensor.to(at::TensorOptions());
|
||||
tensor.to(at::TensorOptions().requires_grad(false));
|
||||
}
|
||||
{
|
||||
auto tensor = torch::empty({3, 4});
|
||||
@@ -113,8 +115,10 @@ TEST(TensorTest, ToOptionsWithRequiresGrad) {
|
||||
// Throws if requires_grad is set in TensorOptions
|
||||
ASSERT_THROW(
|
||||
tensor.to(at::TensorOptions().requires_grad(true)), c10::Error);
|
||||
ASSERT_THROW(
|
||||
tensor.to(at::TensorOptions().requires_grad(false)), c10::Error);
|
||||
|
||||
// Doesn't throw if requires_grad is not set
|
||||
tensor.to(at::TensorOptions());
|
||||
tensor.to(at::TensorOptions().requires_grad(false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user