make a move on compile

This commit is contained in:
Awni Hannun
2024-01-11 06:27:44 -08:00
parent c38d43153b
commit 264e9ad57e
5 changed files with 71 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ target_sources(tests PRIVATE
arg_reduce_tests.cpp
autograd_tests.cpp
blas_tests.cpp
compile_tests.cpp
creations_tests.cpp
device_tests.cpp
eval_tests.cpp

17
tests/compile_tests.cpp Normal file
View File

@@ -0,0 +1,17 @@
// Copyright © 2023 Apple Inc.
#include "doctest/doctest.h"
#include "mlx/mlx.h"
using namespace mlx::core;
std::vector<array> simple_fun(const std::vector<array>& inputs) {
return std::vector<array>{inputs[0] + inputs[1]};
};
TEST_CASE("test simple compile") {
auto compfn = compile(simple_fun);
auto out = compfn({array(1.0), array(2.0)})[0];
CHECK_EQ(out.item<float>(), 3.0f);
}