fix compile merging

This commit is contained in:
Awni Hannun
2025-05-02 13:51:10 -07:00
parent 9daa6b003f
commit b6d643fc17
2 changed files with 18 additions and 0 deletions

View File

@@ -795,3 +795,12 @@ TEST_CASE("test compile lambda") {
out = cfun2({array(0)});
CHECK_EQ(out[0].item<int>(), 3);
}
TEST_CASE("test compile with no-ops") {
auto fun = [](const std::vector<array>& inputs) {
return std::vector<array>{abs(stop_gradient(abs(inputs[0])))};
};
auto in = array(1.0);
auto out = compile(fun)({in})[0];
CHECK_EQ(out.inputs()[0].id(), in.id());
}