mirror of
https://github.com/ml-explore/mlx.git
synced 2025-11-03 18:18:15 +08:00
make a move on compile
This commit is contained in:
@@ -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
17
tests/compile_tests.cpp
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user