mirror of
https://github.com/pytorch/pytorch.git
synced 2026-11-20 09:04:25 +08:00
Expose class constant through attr and setattr in object (#29219)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/29219 We added class constant in previous PRs, this PR allows access to class constant in the object API Test Plan: build/bin/test_jit python test/test_jit.py Imported from OSS Differential Revision: D18846851 fbshipit-source-id: 888a6517d5f747d1f8ced283c0c2c30b2f6c72c6
This commit is contained in:
committed by
Facebook Github Bot
parent
6f62c311a1
commit
ebe69236d1
@@ -416,7 +416,7 @@ TEST(SerializeTest, IValue) {
|
||||
input_archive.read("value", ivalue_out);
|
||||
ASSERT_EQ(ivalue_out.toInt(), 1);
|
||||
|
||||
ASSERT_THROWS_WITH(input_archive.read("bad_key", ivalue_out), "does not have an attribute with name");
|
||||
ASSERT_THROWS_WITH(input_archive.read("bad_key", ivalue_out), "does not have a field with name");
|
||||
}
|
||||
|
||||
// NOTE: if a `Module` contains unserializable submodules (e.g. `nn::Functional`),
|
||||
|
||||
Reference in New Issue
Block a user