@@ -22,8 +22,8 @@ function error() {
22
22
function get_libtorch() {
23
23
echo " Getting libtorch"
24
24
cd $HOME_DIR
25
- wget https://download.pytorch.org/libtorch/nightly/cpu/libtorch-shared-with-deps-latest.zip
26
- unzip libtorch-shared-with-deps-latest.zip
25
+ wget https://download.pytorch.org/libtorch/nightly/cpu/libtorch-cxx11-abi- shared-with-deps-latest.zip
26
+ unzip libtorch-cxx11-abi- shared-with-deps-latest.zip
27
27
28
28
if [ $? -eq 0 ]; then
29
29
echo " Successfully downloaded and extracted libtorch"
@@ -55,18 +55,46 @@ function autograd() {
55
55
fi
56
56
}
57
57
58
+ function custom-dataset() {
59
+ start
60
+ # Download the dataset and unzip it
61
+ if [ ! -d " $BASE_DIR /cpp/$EXAMPLE /dataset" ]; then
62
+ wget https://data.caltech.edu/records/mzrjq-6wc02/files/caltech-101.zip
63
+ unzip caltech-101.zip
64
+ cd caltech-101
65
+ tar -xzf 101_ObjectCategories.tar.gz
66
+ mv 101_ObjectCategories $BASE_DIR /cpp/$EXAMPLE /dataset
67
+ fi
68
+ # build the executable and run it
69
+ cd $BASE_DIR /cpp/$EXAMPLE
70
+ mkdir build
71
+ cd build
72
+ cmake -DCMAKE_PREFIX_PATH=$LIBTORCH_PATH ..
73
+ make
74
+ if [ $? -eq 0 ]; then
75
+ echo " Successfully built $EXAMPLE "
76
+ cd $BASE_DIR /cpp/$EXAMPLE
77
+ ./build/$EXAMPLE # Run the executable
78
+ else
79
+ error " Failed to build $EXAMPLE "
80
+ exit 1
81
+ fi
82
+ }
83
+
58
84
function clean() {
59
85
cd $BASE_DIR
60
86
echo " Running clean to remove cruft"
61
87
# Remove the build directories
62
88
find . -type d -name ' build' -exec rm -rf {} +
63
89
# Remove the libtorch directory
64
90
rm -rf $HOME_DIR /libtorch
91
+ rm -f $HOME_DIR /libtorch-shared-with-deps-latest.zip
65
92
echo " Clean completed"
66
93
}
67
94
68
95
function run_all() {
69
96
autograd
97
+ custom-dataset
70
98
}
71
99
72
100
# by default, run all examples
0 commit comments