Skip to content

Commit

Permalink
Add a test for fusions with no inputs. (#1709)
Browse files Browse the repository at this point in the history
As a follow up to
#1696 (comment).
  • Loading branch information
wujingyue authored Feb 1, 2024
1 parent 37f5c39 commit 653e791
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/test_tensor_factories.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,4 +410,19 @@ TEST_F(TensorFactoryTest, MetadataAsTensor) {
testValidate(fusion.get(), cg_outputs, {input0, input1}, __LINE__, __FILE__);
}

TEST_F(TensorFactoryTest, NoInputs) {
auto fusion = std::make_unique<Fusion>();
FusionGuard fg(fusion.get());

Val* size = IrBuilder::create<Val>(16);
Val* fill_value = IrBuilder::create<Val>(1.0);
TensorView* out = full({size}, fill_value, DataType::Float);
fusion->addOutput(out);

FusionExecutorCache executor_cache(std::move(fusion));

auto out_tensors = executor_cache.runFusionWithInputs({});
testValidate(executor_cache.fusion(), out_tensors, {}, __LINE__, __FILE__);
}

} // namespace nvfuser

0 comments on commit 653e791

Please sign in to comment.