1 |
commit: 1fab63f837034302bb8ffa0ef7a5a18dd1c3cc04 |
2 |
Author: Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com> |
3 |
AuthorDate: Thu May 27 09:35:36 2021 +0000 |
4 |
Commit: Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com> |
5 |
CommitDate: Thu May 27 09:35:36 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=1fab63f8 |
7 |
|
8 |
dev-cpp/tiny-dnn: initial import |
9 |
|
10 |
Signed-off-by: Alessandro Barbieri <lssndrbarbieri <AT> gmail.com> |
11 |
|
12 |
dev-cpp/tiny-dnn/Manifest | 1 + |
13 |
...iny-dnn-add-sphinx-ext-autodoc-to-conf-py.patch | 11 +++ |
14 |
.../files/tiny-dnn-disable-gtest-download.patch | 29 +++++++ |
15 |
dev-cpp/tiny-dnn/metadata.xml | 89 ++++++++++++++++++++++ |
16 |
dev-cpp/tiny-dnn/tiny-dnn-1.0.0_alpha3.ebuild | 84 ++++++++++++++++++++ |
17 |
5 files changed, 214 insertions(+) |
18 |
|
19 |
diff --git a/dev-cpp/tiny-dnn/Manifest b/dev-cpp/tiny-dnn/Manifest |
20 |
new file mode 100644 |
21 |
index 000000000..5cf90f420 |
22 |
--- /dev/null |
23 |
+++ b/dev-cpp/tiny-dnn/Manifest |
24 |
@@ -0,0 +1 @@ |
25 |
+DIST tiny-dnn-1.0.0_alpha3.tar.gz 12885646 BLAKE2B 85c0715ab6c692b77522487775e70b0db645528baed1830c83c9f44d2b67a5207e4f7ea1709b35c6a4217d287199549304e9be19f4a5cec9a1183b0b5dccc562 SHA512 5f2c1a161771efa67e85b1fea395953b7744e29f61187ac5a6c54c912fb195b3aef9a5827135c3668bd0eeea5ae04a33cc433e1f6683e2b7955010a2632d168b |
26 |
|
27 |
diff --git a/dev-cpp/tiny-dnn/files/tiny-dnn-add-sphinx-ext-autodoc-to-conf-py.patch b/dev-cpp/tiny-dnn/files/tiny-dnn-add-sphinx-ext-autodoc-to-conf-py.patch |
28 |
new file mode 100644 |
29 |
index 000000000..4fadeaa90 |
30 |
--- /dev/null |
31 |
+++ b/dev-cpp/tiny-dnn/files/tiny-dnn-add-sphinx-ext-autodoc-to-conf-py.patch |
32 |
@@ -0,0 +1,11 @@ |
33 |
+--- a/docs/conf.py |
34 |
++++ b/docs/conf.py |
35 |
+@@ -32,7 +32,7 @@ |
36 |
+ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
37 |
+ # ones. |
38 |
+ extensions = [ |
39 |
+- 'sphinx.ext.mathjax' |
40 |
++ 'sphinx.ext.mathjax', 'sphinx.ext.autodoc' |
41 |
+ ] |
42 |
+ |
43 |
+ # Add any paths that contain templates here, relative to this directory. |
44 |
|
45 |
diff --git a/dev-cpp/tiny-dnn/files/tiny-dnn-disable-gtest-download.patch b/dev-cpp/tiny-dnn/files/tiny-dnn-disable-gtest-download.patch |
46 |
new file mode 100644 |
47 |
index 000000000..40b65ed23 |
48 |
--- /dev/null |
49 |
+++ b/dev-cpp/tiny-dnn/files/tiny-dnn-disable-gtest-download.patch |
50 |
@@ -0,0 +1,29 @@ |
51 |
+--- a/test/CMakeLists.txt |
52 |
++++ b/test/CMakeLists.txt |
53 |
+@@ -2,17 +2,6 @@ |
54 |
+ enable_testing() |
55 |
+ |
56 |
+ |
57 |
+-include(../cmake/DownloadProject/DownloadProject.cmake) |
58 |
+-#set(gtest_disable_pthreads on) #TODO(randl): Windows? |
59 |
+-download_project( |
60 |
+- PROJ googletest |
61 |
+- GIT_REPOSITORY https://github.com/google/googletest.git |
62 |
+- GIT_TAG master |
63 |
+- UPDATE_DISCONNECTED 1 |
64 |
+-) |
65 |
+- |
66 |
+-add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR}) |
67 |
+- |
68 |
+ enable_testing() |
69 |
+ |
70 |
+ # in ../googletest-src/googletest/CMakeLists.txt, BUILD_SHARED_LIBS is set to OFF |
71 |
+@@ -29,7 +18,7 @@ |
72 |
+ |
73 |
+ add_executable(tiny_dnn_test test.cpp test_no_duplicate_symbols.cpp) |
74 |
+ target_link_libraries(tiny_dnn_test |
75 |
+- ${project_library_target_name} ${REQUIRED_LIBRARIES} gtest gmock) |
76 |
++ ${project_library_target_name} ${REQUIRED_LIBRARIES}) |
77 |
+ |
78 |
+ add_test(all_tests tiny_dnn_test) |
79 |
+ # workaround for https://gitlab.kitware.com/cmake/cmake/issues/8774 |
80 |
|
81 |
diff --git a/dev-cpp/tiny-dnn/metadata.xml b/dev-cpp/tiny-dnn/metadata.xml |
82 |
new file mode 100644 |
83 |
index 000000000..5f2810ee5 |
84 |
--- /dev/null |
85 |
+++ b/dev-cpp/tiny-dnn/metadata.xml |
86 |
@@ -0,0 +1,89 @@ |
87 |
+<?xml version="1.0" encoding="UTF-8"?> |
88 |
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> |
89 |
+<pkgmetadata> |
90 |
+ <maintainer type="person"> |
91 |
+ <email>lssndrbarbieri@×××××.com</email> |
92 |
+ <name>Alessandro Barbieri</name> |
93 |
+ </maintainer> |
94 |
+ <longdescription> |
95 |
+Features |
96 |
+ |
97 |
+Reasonably fast, without GPU: |
98 |
+With TBB threading and SSE/AVX vectorization. |
99 |
+98.8% accuracy on MNIST in 13 minutes training (@Core i7-3520M). |
100 |
+Portable and header-only: |
101 |
+Runs anywhere as long as you have a compiler which supports C++14. |
102 |
+Just include tiny_dnn.h and write your model in C++. There is nothing to install. |
103 |
+Easy to integrate with real applications: |
104 |
+No output to stdout/stderr. |
105 |
+A constant throughput (simple parallelization model, no garbage collection). |
106 |
+Works without throwing an exception. |
107 |
+Can import caffe's model. |
108 |
+Simply implemented: |
109 |
+A good library for learning neural networks. |
110 |
+ |
111 |
+Supported networks |
112 |
+ |
113 |
+layer-types |
114 |
+ |
115 |
+core |
116 |
+fully connected |
117 |
+dropout |
118 |
+linear operation |
119 |
+zero padding |
120 |
+power |
121 |
+convolution |
122 |
+convolutional |
123 |
+average pooling |
124 |
+max pooling |
125 |
+deconvolutional |
126 |
+average unpooling |
127 |
+max unpooling |
128 |
+normalization |
129 |
+contrast normalization (only forward pass) |
130 |
+batch normalization |
131 |
+split/merge |
132 |
+concat |
133 |
+slice |
134 |
+elementwise-add |
135 |
+activation functions |
136 |
+ |
137 |
+tanh |
138 |
+asinh |
139 |
+sigmoid |
140 |
+softmax |
141 |
+softplus |
142 |
+softsign |
143 |
+rectified linear(relu) |
144 |
+leaky relu |
145 |
+identity |
146 |
+scaled tanh |
147 |
+exponential linear units(elu) |
148 |
+scaled exponential linear units (selu) |
149 |
+loss functions |
150 |
+ |
151 |
+cross-entropy |
152 |
+mean squared error |
153 |
+mean absolute error |
154 |
+mean absolute error with epsilon range |
155 |
+optimization algorithms |
156 |
+ |
157 |
+stochastic gradient descent (with/without L2 normalization) |
158 |
+momentum and Nesterov momentum |
159 |
+adagrad |
160 |
+rmsprop |
161 |
+adam |
162 |
+adamax |
163 |
+ </longdescription> |
164 |
+ <use> |
165 |
+ <flag name="double-precision">Build tiny-dnn with double precision computations</flag> |
166 |
+ <!--<flag name="libdnn">Build tiny-dnn with GreenteaLibDNN library support</flag>--> |
167 |
+ <!--<flag name="nnpack">Build tiny-dnn with NNPACK library support</flag>--> |
168 |
+ <flag name="opencl">Build tiny-dnn with OpenCL library support</flag> |
169 |
+ <flag name="serialization">Build tiny-dnn with Serialization support</flag> |
170 |
+ <flag name="tbb">Build tiny-dnn with TBB library support</flag> |
171 |
+ </use> |
172 |
+ <upstream> |
173 |
+ <remote-id type="github">tiny-dnn/tiny-dnn</remote-id> |
174 |
+ </upstream> |
175 |
+</pkgmetadata> |
176 |
|
177 |
diff --git a/dev-cpp/tiny-dnn/tiny-dnn-1.0.0_alpha3.ebuild b/dev-cpp/tiny-dnn/tiny-dnn-1.0.0_alpha3.ebuild |
178 |
new file mode 100644 |
179 |
index 000000000..c01cd7f58 |
180 |
--- /dev/null |
181 |
+++ b/dev-cpp/tiny-dnn/tiny-dnn-1.0.0_alpha3.ebuild |
182 |
@@ -0,0 +1,84 @@ |
183 |
+# Copyright 1999-2021 Gentoo Authors |
184 |
+# Distributed under the terms of the GNU General Public License v2 |
185 |
+ |
186 |
+EAPI=7 |
187 |
+ |
188 |
+DOCS_BUILDER="sphinx" |
189 |
+DOCS_DEPEND="dev-python/recommonmark" |
190 |
+DOCS_DIR="docs" |
191 |
+MYPV="${PV/_alpha/a}" |
192 |
+PYTHON_COMPAT=( python3_{7,8,9} ) |
193 |
+ |
194 |
+inherit cmake python-any-r1 docs |
195 |
+ |
196 |
+DESCRIPTION="header only, dependency-free deep learning framework in C++14" |
197 |
+HOMEPAGE="https://github.com/tiny-dnn/tiny-dnn" |
198 |
+SRC_URI="https://github.com/${PN}/${PN}/archive/refs/tags/v${MYPV}.tar.gz -> ${P}.tar.gz" |
199 |
+S="${WORKDIR}/${PN}-${MYPV}" |
200 |
+LICENSE="BSD" |
201 |
+SLOT="0" |
202 |
+KEYWORDS="~amd64" |
203 |
+IUSE="cpu_flags_x86_avx cpu_flags_x86_avx2 cpu_flags_x86_sse double-precision opencl openmp +serialization tbb test" |
204 |
+REQUIRED_USE=" |
205 |
+ ?? ( openmp tbb ) |
206 |
+" |
207 |
+RESTRICT="test" #tests doesn't build ... |
208 |
+ |
209 |
+# headers as rdepend because this is also an header only library |
210 |
+RDEPEND=" |
211 |
+ opencl? ( |
212 |
+ dev-util/opencl-headers |
213 |
+ virtual/opencl |
214 |
+ ) |
215 |
+ serialization? ( dev-libs/cereal ) |
216 |
+ tbb? ( dev-cpp/tbb ) |
217 |
+" |
218 |
+DEPEND="${RDEPEND}" |
219 |
+BDEPEND=" |
220 |
+ test? ( dev-cpp/gtest ) |
221 |
+" |
222 |
+ |
223 |
+PATCHES=( |
224 |
+ "${FILESDIR}/${PN}-add-sphinx-ext-autodoc-to-conf-py.patch" |
225 |
+ "${FILESDIR}/${PN}-disable-gtest-download.patch" |
226 |
+) |
227 |
+ |
228 |
+src_prepare() { |
229 |
+ #remove bundled cereal |
230 |
+ rm -r cereal || die |
231 |
+ cmake_src_prepare |
232 |
+} |
233 |
+ |
234 |
+src_configure() { |
235 |
+ local mycmakeargs=( |
236 |
+ -DBUILD_DOCS=OFF |
237 |
+ -DBUILD_EXAMPLES=OFF |
238 |
+ -DCOVERALLS=OFF |
239 |
+ -DUSE_LIBDNN=OFF |
240 |
+ -DUSE_NNPACK=OFF |
241 |
+ |
242 |
+ -DBUILD_TESTS=$(usex test) |
243 |
+ -DUSE_AVX=$(usex cpu_flags_x86_avx) |
244 |
+ -DUSE_AVX2=$(usex cpu_flags_x86_avx2) |
245 |
+ -DUSE_DOUBLE=$(usex double-precision) |
246 |
+ -DUSE_OMP=$(usex openmp) |
247 |
+ -DUSE_OPENCL=$(usex opencl) |
248 |
+ -DUSE_SERIALIZER=$(usex serialization) |
249 |
+ -DUSE_SSE=$(usex cpu_flags_x86_sse) |
250 |
+ -DUSE_TBB=$(usex tbb) |
251 |
+ ) |
252 |
+ cmake_src_configure |
253 |
+} |
254 |
+ |
255 |
+src_compile() { |
256 |
+ cmake_src_compile |
257 |
+ docs_compile |
258 |
+} |
259 |
+ |
260 |
+src_install() { |
261 |
+ cmake_src_install |
262 |
+ if use doc; then |
263 |
+ dodoc -r _build/html |
264 |
+ docompress -x "/usr/share/doc/${PF}/html" |
265 |
+ fi |
266 |
+} |