Skip to content

Commit 3cc33a4

Browse files
Add libtorch-2.3 for arm64
1 parent f515aaa commit 3cc33a4

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

[email protected]

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
class LibtorchPrebuildAT23 < Formula
2+
desc "Tensors and dynamic neural networks"
3+
homepage "https://pytorch.org/"
4+
url "https://download.pytorch.org/libtorch/cpu/libtorch-macos-arm64-2.3.0.zip"
5+
sha256 "ff86ea62ac24a27bba31490d95a8fab6beab8aab5abe72978300568c49bf2150"
6+
license "BSD-3-Clause"
7+
8+
def install
9+
system "bash", "-c", "cd include/torch; for i in csrc/api/include/torch/* ; do ln -s $i ;done"
10+
system "bash", "-c", "install -d #{include}"
11+
system "bash", "-c", "install -d #{lib}"
12+
system "bash", "-c", "install -d #{share}"
13+
system "bash", "-c", "cp -a include/* #{include}"
14+
system "bash", "-c", "cp -a lib/* #{lib}"
15+
system "bash", "-c", "cp -a share/* #{share}"
16+
end
17+
18+
test do
19+
(testpath/"test.cpp").write <<~EOS
20+
#include <torch/torch.h>
21+
#include <iostream>
22+
23+
int main() {
24+
torch::Tensor tensor = torch::rand({2, 3});
25+
std::cout << tensor << std::endl;
26+
}
27+
EOS
28+
system ENV.cxx, "-std=c++17", "-L#{lib}", "-ltorch", "-ltorch_cpu", "-lc10", "test.cpp", "-o", "test"
29+
system "./test"
30+
end
31+
end

0 commit comments

Comments
 (0)