mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
[Static Runtime] Fix ReplaceWithMaybeCopy test in OSS (#88099)
Summary: `ReplaceWithMaybeCopy` is guarded by `FBCODE_CAFFE` in `OptimizeGraph`. Run the pass manually to ensure it does the replacement. Test Plan: Existing tests Differential Revision: D40858743 Pull Request resolved: https://github.com/pytorch/pytorch/pull/88099 Approved by: https://github.com/huydhn
This commit is contained in:
parent
7c6fe21a38
commit
23fe6c8ca1
|
|
@ -3194,9 +3194,14 @@ TEST(StaticRuntime, ReplaceWithMaybeCopy) {
|
|||
smodule.runtime().check_for_memory_leak();
|
||||
|
||||
EXPECT_TRUE(expected.equal(actual));
|
||||
EXPECT_FALSE(hasProcessedNodeWithName(smodule, "aten::to"));
|
||||
|
||||
// Make a fresh graph to ensure the pass works in isolation
|
||||
auto new_graph = std::make_shared<torch::jit::Graph>();
|
||||
torch::jit::parseIR(to, new_graph.get());
|
||||
ReplaceWithMaybeCopy(new_graph);
|
||||
EXPECT_FALSE(hasNodeWithKind(new_graph, "aten::to"));
|
||||
EXPECT_TRUE(
|
||||
hasProcessedNodeWithName(smodule, "static_runtime::to_maybe_copy_out"));
|
||||
hasNodeWithKind(new_graph, "static_runtime::to_maybe_copy_out"));
|
||||
}
|
||||
|
||||
TEST(StaticRuntime, Int) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user