1#ifndef dcnnelements_hpp_
2#define dcnnelements_hpp_
12 struct permutation_policy_tag {};
13 struct permutation_policy_back_tag {};
15 template<
typename PP>
16 concept is_policy = std::derived_from<PP, permutation_policy_tag>
17 && (!std::derived_from<PP, permutation_policy_back_tag>);
19 template<
typename BPP>
20 concept is_policy_back = std::derived_from<BPP, permutation_policy_back_tag>;
25 using dcnnasgn::is_policy;
27 template<
typename SP, is_policy PP>
30 template<
typename CSP, is_policy PP>
33 template<
typename KSP,
typename CSPI,
typename CSPO, is_policy PP>
36 template<
typename CSPI,
typename CSPO, is_policy PP>
37 class feature_weights;
39 template<
typename CSP, is_policy PP>
40 class feature_multiplier;
42 template<
typename CSP, is_policy PP>
45 template<
typename CSPI,
typename CSPO,
typename KSP, is_policy PP>
46 class complete_cnn_model;
48 template<
typename SPI,
typename SPO, is_policy PP>
49 struct complete_cnn_internal;
51 template<
typename SPI,
typename SPO,
typename KSP, is_policy PP>
52 struct complete_cnn_layer;
64 struct input_tag : tagged::tag_base {};
65 using input_range = tagged::range_class< input_tag>;
66 using input_index = tagged::index_class< input_tag>;
101 template< std::
size_t H>
102 struct height_stag : tagged::sr_tag<height_selector, 0, H> {};
104 template< std::
size_t W>
105 struct width_stag : tagged::sr_tag<width_selector, 0, W> {};
119 template< std::
size_t H, std::
size_t W>
152 template< std::
size_t C>
153 struct channel_stag : tagged::sr_tag<channel_selector, 0, C> {};
180 template<
typename ISP,
typename CP>
181 struct input_data_policy : ISP, CP {
182 using typename ISP::height_tag;
183 using typename ISP::width_tag;
184 using typename CP::channel_tag;
190 using image_carrier = float;
196 template<
typename ISP,
typename CP>
199 using policy = input_data_policy< ISP, CP>;
200 input_data(
const input_range& inr) : images(inr& policy::hr& policy::wr& policy::cr) {}
201 policy::images_t images;
204 template<
typename ISP,
typename CP>
207 using policy = input_data_policy< ISP, CP>;
209 using height_tag =
typename policy::height_tag;
210 using width_tag =
typename policy::width_tag;
211 using channel_tag =
typename policy::channel_tag;
213 batch_data(
const batch_range& nr) : images(nr& policy::hr& policy::wr& policy::cr) {}
214 typename policy::batch_t images;
215 void init(
const typename policy::images_t& ind,
const input_range& inr)
217 auto hr = policy::hr;
218 auto wr = policy::wr;
219 auto cr = policy::cr;
221 static_assert(ind.range().
template get<height_tag>() == hr);
222 static_assert(ind.range().
template get<width_tag>() == wr);
223 static_assert(ind.range().
template get<channel_tag>() == cr);
225 static_assert(images.range().
template get<height_tag>() == hr);
226 static_assert(images.range().
template get<width_tag>() == wr);
227 static_assert(images.range().
template get<channel_tag>() == cr);
229 assert(images.range().template get<batch_tag>().size() == inr.size());
231 auto inrb = (*inr.begin()).value();
234 tagged::index_class<batch_tag> b(i.value() - inrb);
241 images[b & h & w & c] = ind[i & h & w & c];
247 void init(
const typename policy::images_t& ind,
const batch_mapping& bmap)
249 static constexpr auto hr = policy::hr;
250 static constexpr auto wr = policy::wr;
251 auto cr = policy::cr;
253 assert(ind.range().template get<height_tag>() == hr);
254 assert(ind.range().template get<width_tag>() == wr);
255 assert(ind.range().template get<channel_tag>() == cr);
257 assert(images.range().template get<height_tag>() == hr);
258 assert(images.range().template get<width_tag>() == wr);
259 assert(images.range().template get<channel_tag>() == cr);
261 assert(images.range().template get<batch_tag>() == bmap.range().get<batch_tag>());
263 for (
auto b : bmap.range())
272 images[b & h & w & c] = ind[i & h & w & c];
280 struct gold_labels_policy {
281 using label_carrier = std::uint32_t;
283 using labels_t = tagged::tensor_class< label_carrier, input_tag>;
284 using batch_t = tagged::tensor_class< label_carrier, batch_tag>;
289 using policy = gold_labels_policy;
290 gold_labels(
const input_range& inr) : labels(inr) {}
291 policy::labels_t labels;
296 using policy = gold_labels_policy;
297 gold_data(
const batch_range& nr) : labels(nr) {}
298 policy::batch_t labels;
299 void init(
const policy::labels_t& ind,
const input_range& inr)
301 assert(labels.range().get<batch_tag>().size() == inr.size());
303 auto inrb = (*inr.begin()).value();
306 tagged::index_class<batch_tag> b(i.value() - inrb);
310 void init(
const policy::labels_t& ind,
const batch_mapping& bmap)
312 assert(labels.range().get<batch_tag>().size() == bmap.range().size());
314 for (
auto b : bmap.range())
333 template< std::
size_t C>
351 template<
typename ISP,
typename CSP>
368 template<
typename SP, is_policy PP>
373 using typename SP::height_tag;
377 using typename SP::width_tag;
381 using typename SP::channel_tag;
386 inline static constexpr auto hr = SP::hr;
390 inline static constexpr auto wr = SP::wr;
394 inline static constexpr auto cr = SP::cr;
417 template<
typename CSP, is_policy PP>
419 using typename CSP::channel_tag;
424 inline static constexpr auto cr = CSP::cr;
485 template< tagged::tag T1, tagged::tag T2>
486 struct delta_functor {
487 delta_functor(std::ptrdiff_t delta)
491 std::ptrdiff_t delta()
const
498 auto dox = ko.value();
502 std::ptrdiff_t delta_;
510 template< tagged::tag T1, tagged::tag T2>
511 struct neg_delta_functor {
512 neg_delta_functor(std::ptrdiff_t delta)
516 std::ptrdiff_t delta()
const
523 auto dox = ko.value();
527 std::ptrdiff_t delta_;
536 template< tagged::tag T1, tagged::tag T2, std::ptrdiff_t MUL>
537 struct mul_delta_functor {
538 mul_delta_functor(std::ptrdiff_t delta)
542 std::ptrdiff_t delta()
const
547 inline static constexpr std::ptrdiff_t multiplier = MUL;
551 auto dox = ko.value();
555 std::ptrdiff_t delta_;
567 first_stat() : sumx(0), sumx2(0), E(0.0f), var(0.0f), scale(0.0f) {}
587 template<
typename SP, is_policy PP>
590 using ISP =
typename SP::image_policy;
591 using CSP =
typename SP::channel_policy;
621 inline static constexpr auto hr = SP::hr;
622 inline static constexpr auto wr = SP::wr;
623 inline static constexpr auto cr = SP::cr;
628 auto&& inv = ind.images;
629 auto&& sumx = cd.sumx;
630 auto&& sumx2 = cd.sumx2;
633 auto&& scale = cd.scale;
634 auto&& outv = outd.values;
636 auto&& inr = inv.range();
637 auto&& outr = outv.range();
639 auto&& br = inr.template get<batch_tag>();
641 static_assert(inr.template get<height_tag>() ==
hr);
642 static_assert(inr.template get<width_tag>() ==
wr);
644 static_assert(outr.template get<height_tag>() ==
hr);
645 static_assert(outr.template get<width_tag>() ==
wr);
646 static_assert(outr.template get<channel_tag>() ==
cr);
648 assert(outr.template get<batch_tag>() == br);
654 static std::size_t forward_complexity(
const batch_range & br)
656 return (br &
hr &
wr &
cr).size();
668 template< std::
size_t KH>
669 struct kernel_height_stag : tagged::sr_tag<kernel_height_selector, 0, KH> {};
671 template< std::
size_t KW>
672 struct kernel_width_stag : tagged::sr_tag<kernel_width_selector, 0, KW> {};
688 template< std::
size_t KH, std::
size_t KW>
719 template<
typename KSP,
typename CSPI,
typename CSPO>
726 using typename KSP::kernel_height_tag;
727 using typename KSP::kernel_width_tag;
741 inline static constexpr auto cir = CSPI::cr;
742 inline static constexpr auto cor = CSPO::cr;
755 template<
typename CSPI,
typename CSPO>
772 inline static constexpr auto cir = CSPI::cr;
773 inline static constexpr auto cor = CSPO::cr;
785 template<
typename KSP,
typename CSPI,
typename CSPO, is_policy PP>
790 using typename base_::kernel_height_tag;
791 using typename base_::kernel_width_tag;
823 template<
typename CSPI,
typename CSPO, is_policy PP>
859 template<std::
size_t KD, std::
size_t S>
861 static_assert(KD / 2 >= S - 1);
862 inline static constexpr std::size_t LPAD = (KD - 1) / 2;
863 inline static constexpr std::size_t SHIFT = (KD - 1) / 2;
864 inline static constexpr std::size_t RPAD = KD / 2 + 1 - S;
877 template< tagged::tag TK, tagged::tag TO, std::
size_t DI, std::
size_t KD, std::
size_t S>
879 using traits = conv_traits<KD, S>;
880 static_assert(DI > traits::LPAD);
881 static_assert(DI > traits::RPAD);
884 auto dox = o.value() * S;
896 template< tagged::tag TI, tagged::tag TK, tagged::tag TO, std::
size_t KD, std::
size_t S>
898 using traits = conv_traits<KD, S>;
902 auto dox = o.value() * S;
903 return df(dox - traits::SHIFT);
914 template< tagged::tag TI, tagged::tag TK, std::
size_t DI, std::
size_t KD, std::
size_t S>
916 using traits = conv_traits<KD, S>;
917 static_assert(DI > traits::LPAD);
918 static_assert(DI > traits::RPAD);
921 static_assert(S == 1,
"The kernel range is not contiguous for stride > 1");
922 auto dix = i.value();
934 template< tagged::tag TI, tagged::tag TK, tagged::tag TO, std::
size_t KD, std::
size_t S>
936 using traits = conv_traits<KD, S>;
940 static_assert(S == 1,
"The kernel range is not contiguous for stride > 1");
941 auto dix = i.value();
942 return df(dix + traits::SHIFT);
953 template< tagged::tag TK, tagged::tag TO, std::
size_t DI, std::
size_t KD, std::
size_t S>
955 using traits = conv_traits<KD, S>;
956 static_assert(DI > traits::LPAD);
957 static_assert(DI > traits::RPAD);
960 auto dkx = k.value();
972 template< tagged::tag TK, tagged::tag TO, tagged::tag TI, std::
size_t KD, std::
size_t S>
974 using traits = conv_traits<KD, S>;
978 auto dkx = k.value();
979 return df(dkx - traits::SHIFT);
996 template<
typename SPI,
typename SPO,
typename KSP, is_policy PP>
1000 using CSPI =
typename SPI::channel_policy;
1001 using CSPO =
typename SPO::channel_policy;
1013 using weights = dcnnsol::conv_weights<KSP, CSPI, CSPO, PP>;
1036 static_assert(tagged::same_tag<height_in_tag, height_out_tag>);
1037 static_assert(tagged::same_tag<width_in_tag, width_out_tag>);
1045 inline static constexpr auto hir = SPI::hr;
1046 inline static constexpr auto wir = SPI::wr;
1047 inline static constexpr auto cir = SPI::cr;
1048 inline static constexpr auto khr = KSP::khr;
1049 inline static constexpr auto kwr = KSP::kwr;
1050 inline static constexpr auto hor = SPO::hr;
1051 inline static constexpr auto wor = SPO::wr;
1052 inline static constexpr auto cor = SPO::cr;
1116 auto&& inv = ind.values;
1117 auto&& wtv = wtd.weights;
1118 auto&& outv = outd.values;
1120 auto&& inr = inv.range();
1121 auto&& wtr = wtv.range();
1122 auto&& outr = outv.range();
1124 auto&& br = inr.template get<batch_tag>();
1126 static_assert(inr.template get<height_in_tag>() ==
hir);
1127 static_assert(inr.template get<width_in_tag>() ==
wir);
1128 static_assert(inr.template get<channel_in_tag>() ==
cir);
1130 static_assert(wtr.template get<kernel_height_tag>() ==
khr);
1131 static_assert(wtr.template get<kernel_width_tag>() ==
kwr);
1132 static_assert(wtr.template get< tagged::co<channel_in_tag>>() ==
~cir);
1133 static_assert(wtr.template get<channel_out_tag>() ==
cor);
1135 static_assert(outr.template get<height_out_tag>() ==
hor);
1136 static_assert(outr.template get<width_out_tag>() ==
wor);
1137 static_assert(outr.template get<channel_out_tag>() ==
cor);
1139 assert(outr.template get<batch_tag>() == br);
1144 static std::size_t forward_complexity(
const batch_range & br)
1160 template<
typename SPI,
typename SPO,
typename KSP, is_policy PP>
1164 using CSPI =
typename SPI::channel_policy;
1165 using CSPO =
typename SPO::channel_policy;
1177 using weights = dcnnsol::conv_weights<KSP, CSPI, CSPO, PP>;
1206 inline static constexpr auto hir = SPI::hr;
1207 inline static constexpr auto wir = SPI::wr;
1208 inline static constexpr auto cir = SPI::cr;
1209 inline static constexpr auto khr = KSP::khr;
1210 inline static constexpr auto kwr = KSP::kwr;
1211 inline static constexpr auto hor = SPO::hr;
1212 inline static constexpr auto wor = SPO::wr;
1213 inline static constexpr auto cor = SPO::cr;
1219 static_assert(
hir.size() %
hor.size() == 0);
1220 static_assert(
wir.size() %
wor.size() == 0);
1227 inline static constexpr std::size_t HSTRIDE =
hir.size() /
hor.size();
1228 inline static constexpr std::size_t WSTRIDE =
wir.size() /
wor.size();
1290 auto&& inv = ind.values;
1291 auto&& wtv = wtd.weights;
1292 auto&& outv = outd.values;
1294 auto&& inr = inv.range();
1295 auto&& wtr = wtv.range();
1296 auto&& outr = outv.range();
1298 auto&& br = inr.template get<batch_tag>();
1300 static_assert(inr.template get<height_in_tag>() ==
hir);
1301 static_assert(inr.template get<width_in_tag>() ==
wir);
1302 static_assert(inr.template get<channel_in_tag>() ==
cir);
1304 static_assert(wtr.template get<kernel_height_tag>() ==
khr);
1305 static_assert(wtr.template get<kernel_width_tag>() ==
kwr);
1306 static_assert(wtr.template get< tagged::co<channel_in_tag>>() ==
~cir);
1307 static_assert(wtr.template get<channel_out_tag>() ==
cor);
1309 static_assert(outr.template get<height_out_tag>() ==
hor);
1310 static_assert(outr.template get<width_out_tag>() ==
wor);
1311 static_assert(outr.template get<channel_out_tag>() ==
cor);
1313 assert(outr.template get<batch_tag>() == br);
1318 static std::size_t forward_complexity(
const batch_range& br)
1334 template<
typename CSP>
1335 struct image_normalize_internal_policy : CSP {
1336 using typename CSP::channel_tag;
1340 using stat_t = tagged::tensor_class< float, channel_tag>;
1351 template<
typename CSP>
1352 class image_normalize_model {
1354 using policy = image_normalize_internal_policy< CSP>;
1355 image_normalize_model() : Es(policy::cr), scales(policy::cr) {}
1357 policy::stat_t scales;
1372 template<
typename SP, is_policy PP>
1375 using CSP =
typename SP::channel_policy;
1403 inline static constexpr auto hr = SP::hr;
1404 inline static constexpr auto wr = SP::wr;
1405 inline static constexpr auto cr = SP::cr;
1409 auto&& inv = ind.values;
1411 auto&& scalev = nd.scales;
1412 auto&& outv = outd.values;
1414 auto&& inr = inv.range();
1415 auto&& Er = Ev.range();
1416 auto&& scaler = scalev.range();
1417 auto&& outr = outv.range();
1419 auto&& br = inr.template get<batch_tag>();
1421 static_assert(inr.template get<height_tag>() ==
hr);
1422 static_assert(inr.template get<width_tag>() ==
wr);
1423 static_assert(inr.template get<channel_tag>() ==
cr);
1425 static_assert(Er.template get<channel_tag>() ==
cr);
1427 static_assert(scaler.template get<channel_tag>() ==
cr);
1429 static_assert(outr.template get<height_tag>() ==
hr);
1430 static_assert(outr.template get<width_tag>() ==
wr);
1431 static_assert(outr.template get<channel_tag>() ==
cr);
1433 assert(outr.template get<batch_tag>() == br);
1439 static std::size_t forward_complexity(
const batch_range & br)
1452 template<
typename CSP, is_policy PP>
1454 using typename CSP::channel_tag;
1473 template<
typename SP, is_policy PP>
1476 using CSP =
typename SP::channel_policy;
1508 inline static constexpr auto hr = SP::hr;
1509 inline static constexpr auto wr = SP::wr;
1510 inline static constexpr auto cr = SP::cr;
1526 auto&& inv = ind.values;
1527 auto&& multiplierv = cd.multipliers;
1528 auto&& outv = outd.values;
1530 auto&& inr = inv.range();
1531 auto&& multiplierr = multiplierv.range();
1532 auto&& outr = outv.range();
1534 auto&& br = inr.template get<batch_tag>();
1536 static_assert(inr.template get<height_tag>() ==
hr);
1537 static_assert(inr.template get<width_tag>() ==
wr);
1538 static_assert(inr.template get<channel_tag>() ==
cr);
1540 static_assert(multiplierr.template get<channel_tag>() ==
cr);
1542 static_assert(outr.template get<height_tag>() ==
hr);
1543 static_assert(outr.template get<width_tag>() ==
wr);
1544 static_assert(outr.template get<channel_tag>() ==
cr);
1546 assert(outr.template get<batch_tag>() == br);
1552 static std::size_t forward_complexity(
const batch_range & br)
1565 template<
typename CSP, is_policy PP>
1567 using typename CSP::channel_tag;
1586 template<
typename SP, is_policy PP>
1589 using CSP =
typename SP::channel_policy;
1622 inline static constexpr auto hr = SP::hr;
1623 inline static constexpr auto wr = SP::wr;
1624 inline static constexpr auto cr = SP::cr;
1640 auto&& inv = ind.values;
1641 auto&& betav = cd.betas;
1642 auto&& outv = outd.values;
1644 auto&& inr = inv.range();
1645 auto&& betar = betav.range();
1646 auto&& outr = outv.range();
1648 auto&& br = inr.template get<batch_tag>();
1650 static_assert(inr.template get<height_tag>() ==
hr);
1651 static_assert(inr.template get<width_tag>() ==
wr);
1652 static_assert(inr.template get<channel_tag>() ==
cr);
1654 static_assert(betar.template get<channel_tag>() ==
cr);
1656 static_assert(outr.template get<height_tag>() ==
hr);
1657 static_assert(outr.template get<width_tag>() ==
wr);
1658 static_assert(outr.template get<channel_tag>() ==
cr);
1660 assert(outr.template get<batch_tag>() == br);
1666 static std::size_t forward_complexity(
const batch_range& br)
1673 template<
typename SP, is_policy PP>
1675 using input_data = dcnnsol::image_data<SP, PP>;
1676 using output_data = dcnnsol::image_data<SP, PP>;
1678 using height_tag =
typename SP::height_tag;
1679 using width_tag =
typename SP::width_tag;
1680 using channel_tag =
typename SP::channel_tag;
1682 inline static constexpr auto hr = SP::hr;
1683 inline static constexpr auto wr = SP::wr;
1684 inline static constexpr auto cr = SP::cr;
1688 auto&& inv = ind.values;
1689 auto&& outv = outd.values;
1691 auto&& inr = inv.range();
1692 auto&& outr = outv.range();
1694 auto&& br = inr.template get<batch_tag>();
1696 static_assert(inr.template get<height_tag>() == hr);
1697 static_assert(inr.template get<width_tag>() == wr);
1698 static_assert(inr.template get<channel_tag>() == cr);
1700 static_assert(outr.template get<height_tag>() == hr);
1701 static_assert(outr.template get<width_tag>() == wr);
1702 static_assert(outr.template get<channel_tag>() == cr);
1704 assert(outr.template get<batch_tag>() == br);
1710 static std::size_t forward_complexity(
const batch_range & br)
1712 return (br & hr & wr & cr).
size();
1726 template< std::
size_t KH>
1729 template< std::
size_t KW>
1738 template< tagged::tag TK, tagged::tag TO, tagged::tag TI, std::
size_t KD>
1743 auto dkx = k.value();
1754 template<
typename SPI,
typename SPO, is_policy PP>
1757 static_assert(SPI::hr.size() % SPO::hr.size() == 0);
1758 static_assert(SPI::wr.size() % SPO::wr.size() == 0);
1759 static_assert(SPI::cr == SPO::cr);
1761 static constexpr std::size_t KH = SPI::hr.size() / SPO::hr.size();
1762 static constexpr std::size_t KW = SPI::wr.size() / SPO::wr.size();
1764 using input_data = dcnnsol::image_data<SPI, PP>;
1765 using output_data = dcnnsol::image_data<SPO, PP>;
1767 using height_in_tag =
typename SPI::height_tag;
1768 using width_in_tag =
typename SPI::width_tag;
1769 using channel_tag =
typename SPI::channel_tag;
1771 using height_out_tag =
typename SPO::height_tag;
1772 using width_out_tag =
typename SPO::width_tag;
1774 static_assert(tagged::same_tag<channel_tag, typename SPO::channel_tag>);
1776 inline static constexpr auto hir = SPI::hr;
1777 inline static constexpr auto wir = SPI::wr;
1778 inline static constexpr auto cr = SPI::cr;
1786 inline static constexpr auto hor = SPO::hr;
1787 inline static constexpr auto wor = SPO::wr;
1794 auto&& inv = ind.values;
1795 auto&& outv = outd.values;
1797 auto&& inr = inv.range();
1798 auto&& outr = outv.range();
1800 auto&& br = inr.template get<batch_tag>();
1802 static_assert(inr.template get<height_in_tag>() == hir);
1803 static_assert(inr.template get<width_in_tag>() == wir);
1804 static_assert(inr.template get<channel_tag>() == cr);
1806 static_assert(outr.template get<height_out_tag>() == hor);
1807 static_assert(outr.template get<width_out_tag>() == wor);
1808 static_assert(outr.template get<channel_tag>() == cr);
1810 assert(outr.template get<batch_tag>() == br);
1816 static std::size_t forward_complexity(
const batch_range & br)
1818 return (br & khr & kwr & hor & wor & cr).
size();
1823 template<
typename SPI,
typename CSPO, is_policy PP>
1827 using CSPI =
typename SPI::channel_policy;
1829 static_assert(CSPI::cr == CSPO::cr);
1860 inline static constexpr auto hir = SPI::hr;
1861 inline static constexpr auto wir = SPI::wr;
1862 inline static constexpr auto cr = SPI::cr;
1880 auto&& inv = ind.values;
1881 auto&& outv = outd.values;
1883 auto&& inr = inv.range();
1884 auto&& outr = outv.range();
1886 auto&& br = inr.template get<batch_tag>();
1888 static_assert(inr.template get<height_in_tag>() ==
hir);
1889 static_assert(inr.template get<width_in_tag>() ==
wir);
1890 static_assert(inr.template get<channel_tag>() ==
cr);
1892 static_assert(outr.template get<channel_tag>() ==
cr);
1894 assert(outr.template get<batch_tag>() == br);
1900 static std::size_t forward_complexity(
const batch_range& br)
1919 template<
typename CSP>
1922 using kernel_height_tag = tagged::retag< dcnnasgn::kernel_height_selector, typename CSP::height_tag>;
1923 using kernel_width_tag = tagged::retag< dcnnasgn::kernel_width_selector, typename CSP::width_tag>;
1925 inline static constexpr auto khr = CSP::hr.template retag< kernel_height_tag>();
1926 inline static constexpr auto kwr = CSP::wr.template retag< kernel_width_tag>();
1940 template< tagged::tag TI, tagged::tag TK>
1944 return i.template retag<TK>();
1960 template<
typename CSPI,
typename CSPO, is_policy PP>
1974 using weights = dcnnsol::feature_weights< CSPI, CSPO, PP>;
1997 inline static constexpr auto cir = CSPI::cr;
1998 inline static constexpr auto cor = CSPO::cr;
2002 inline static constexpr std::size_t
fanin =
cir.size();
2016 auto&& inv = ind.values;
2017 auto&& wtv = wtd.weights;
2018 auto&& outv = outd.values;
2020 auto&& inr = inv.range();
2021 auto&& wtr = wtv.range();
2022 auto&& outr = outv.range();
2024 auto&& br = inr.template get<batch_tag>();
2026 static_assert(inr.template get<channel_in_tag>() ==
cir);
2028 static_assert(wtr.template get< tagged::co<channel_in_tag>>() ==
~cir);
2029 static_assert(wtr.template get<channel_out_tag>() ==
cor);
2031 static_assert(outr.template get<channel_out_tag>() ==
cor);
2033 assert(outr.template get<batch_tag>() == br);
2039 static std::size_t forward_complexity(
const batch_range& br)
2046 template<
typename CSP, is_policy PP>
2048 using input_data = dcnnsol::feature_data<CSP, PP>;
2049 using bias_data = dcnnsol::feature_bias<CSP, PP>;
2050 using output_data = dcnnsol::feature_data<CSP, PP>;
2052 using typename CSP::channel_tag;
2058 auto&& inv = ind.values;
2059 auto&& betav = cd.betas;
2060 auto&& outv = outd.values;
2062 auto&& inr = inv.range();
2063 auto&& betar = betav.range();
2064 auto&& outr = outv.range();
2066 auto&& br = inr.template get<batch_tag>();
2068 static_assert(inr.template get<channel_tag>() == cr);
2070 static_assert(betar.template get<channel_tag>() == cr);
2072 static_assert(outr.template get<channel_tag>() == cr);
2074 assert(outr.template get<batch_tag>() == br);
2080 static std::size_t forward_complexity(
const batch_range & br)
2082 return (br & cr).
size();
2087 template<
typename CSP, is_policy PP>
2090 using input_data = dcnnsol::feature_data<CSP, PP>;
2093 using channel_tag =
typename CSP::channel_tag;
2095 inline static constexpr auto cr = CSP::cr;
2099 auto&& inv = ind.values;
2100 auto&& labelv = gd.labels;
2101 auto&& outv = outd.loss;
2103 auto&& inr = inv.
range();
2104 auto&& labelr = labelv.range();
2105 auto&& outr = outv.range();
2107 auto&& br = inr.template get<batch_tag>();
2109 static_assert(inr.template get<channel_tag>() == cr);
2111 assert(labelr.template get<batch_tag>() == br);
2113 assert(outr.template get<batch_tag>() == br);
2119 static std::size_t forward_complexity(
const batch_range & br)
2121 return (br & cr).
size();
Loss data class.
Definition dcnnelements.hpp:461
A list of tagged indexes (a position in an N-dimensional space)
Definition tagged.hpp:584
A list of tagged ranges (an N-dimensional box)
Definition tagged.hpp:733
std::size_t size() const
Size (volume) of the range.
Definition tagged.hpp:751
A tensor - a multi-dimensional tagged generalization of vector/matrix.
Definition tagged.hpp:1365
const range_class< TL ... > & range() const
The range corresponding to this tensor.
Definition tagged.hpp:1458
tagged::range_class< batch_tag > batch_range
The range of images within a minibatch.
Definition dcnnelements.hpp:83
typename impl::tag_traits< T >::selector selector
Extract selector tag from any tag.
Definition tagged.hpp:43
retag< typename impl::co_traits< selector< T > >::co, T > co
Provide a co-tag for a given tag.
Definition tagged.hpp:1645
impl::permute_t< P, impl::permutator_tensor_class< E, TL... > > permute_tensor_class
Provide a tensor_class for the selected dimensions with layout specified by a tagged::tag_list.
Definition tagged.hpp:1593
Functor to cast input to kernel indexes (without any change in value).
Definition dcnnelements.hpp:1941
Retag input dimension policy as kernel dimension policy.
Definition dcnnelements.hpp:1921
Tag: Images within a minibatch.
Definition dcnnelements.hpp:72
Tag: Channel dimension.
Definition dcnnelements.hpp:149
Channel size policy.
Definition dcnnelements.hpp:334
static constexpr tagged::range_class< channel_tag > cr
Channel index range, statically sized.
Definition dcnnelements.hpp:343
channel_stag< C > channel_tag
Tag: The channel dimension, statically sized.
Definition dcnnelements.hpp:338
Functor: Input index to kernel index range.
Definition dcnnelements.hpp:915
Functor: Input index to neg_delta_functor.
Definition dcnnelements.hpp:935
Policy class: Convolution kernel dimensions.
Definition dcnnelements.hpp:689
static constexpr tagged::range_class< kernel_height_tag > khr
Kernel (convolution) height range.
Definition dcnnelements.hpp:705
static constexpr tagged::range_class< kernel_width_tag > kwr
Kernel (convolution) width range.
Definition dcnnelements.hpp:706
kernel_width_stag< KW > kernel_width_tag
Kernel (convolution) width.
Definition dcnnelements.hpp:696
kernel_height_stag< KH > kernel_height_tag
Kernel (convolution) height.
Definition dcnnelements.hpp:695
Functor: Kernel index to output index range.
Definition dcnnelements.hpp:954
Functor: Kernel index to delta_functor.
Definition dcnnelements.hpp:973
Functor: Output index to kernel index range.
Definition dcnnelements.hpp:878
Functor: Output index to delta_functor.
Definition dcnnelements.hpp:897
Policy class: Model weight data types for convolutional layers.
Definition dcnnelements.hpp:786
tagged::permute_tensor_class< typename PP::weights, float, kernel_height_tag, kernel_width_tag, tagged::co< channel_in_tag >, channel_out_tag > weights_t
The tensor containing the weights of the convolution.
Definition dcnnelements.hpp:811
typename CSPO::channel_tag channel_out_tag
Output channel tag.
Definition dcnnelements.hpp:730
Policy class: Model weight dimensions for convolutional layers.
Definition dcnnelements.hpp:720
typename CSPO::channel_tag channel_out_tag
Output channel tag.
Definition dcnnelements.hpp:730
static constexpr auto cir
Input channel range.
Definition dcnnelements.hpp:741
typename CSPI::channel_tag channel_in_tag
Input channel tag.
Definition dcnnelements.hpp:729
static constexpr auto cor
Output channel range.
Definition dcnnelements.hpp:742
Functor to add a fixed value.
Definition dcnnelements.hpp:486
Definition dcnnelements.hpp:1566
Utility base class for the fully connected layer.
Definition dcnnelements.hpp:1962
dcnnsol::feature_weights< CSPI, CSPO, PP > weights
Model weights.
Definition dcnnelements.hpp:1974
static constexpr std::size_t fanin
Number of inputs for each output element.
Definition dcnnelements.hpp:2002
typename CSPO::channel_tag channel_out_tag
Output feature channel.
Definition dcnnelements.hpp:1987
static constexpr auto cor
Output feature channel range.
Definition dcnnelements.hpp:1998
dcnnsol::feature_data< CSPI, PP > input_data
Input activations.
Definition dcnnelements.hpp:1970
static constexpr auto cir
Input feature channel range.
Definition dcnnelements.hpp:1997
typename CSPI::channel_tag channel_in_tag
Input feature channel.
Definition dcnnelements.hpp:1985
static tagged::range_class< batch_tag > forward_check(const input_data &ind, const weights &wtd, output_data &outd)
Check argument compatibility for the forward function.
Definition dcnnelements.hpp:2014
dcnnsol::feature_data< CSPO, PP > output_data
Output activations.
Definition dcnnelements.hpp:1978
Final layer activation data policy.
Definition dcnnelements.hpp:418
static constexpr auto cr
Channel index range, statically sized.
Definition dcnnelements.hpp:424
tagged::permute_tensor_class< tagged::co_list< typename PP::feature_data >, float, tagged::co< channel_tag >, tagged::co< batch_tag > > co_values_t
2-dimensional tensor type carrying loss derivatives wrt. activations
Definition dcnnelements.hpp:439
tagged::permute_tensor_class< typename PP::feature_data, float, channel_tag, batch_tag > values_t
2-dimensional tensor type carrying activations
Definition dcnnelements.hpp:431
Definition dcnnelements.hpp:1453
Definition dcnnelements.hpp:2047
Policy class: Model weight data types for fully connected layers.
Definition dcnnelements.hpp:824
typename CSPO::channel_tag channel_out_tag
Output channel tag.
Definition dcnnelements.hpp:763
tagged::permute_tensor_class< typename PP::feature_weights, float, tagged::co< channel_in_tag >, channel_out_tag > weights_t
The tensor containing the weights of the convolution.
Definition dcnnelements.hpp:847
Policy class: Model weight dimensions for fully connected layers.
Definition dcnnelements.hpp:756
typename CSPO::channel_tag channel_out_tag
Output channel tag.
Definition dcnnelements.hpp:763
static constexpr auto cor
Output channel range.
Definition dcnnelements.hpp:773
static constexpr auto cir
Input channel range.
Definition dcnnelements.hpp:772
typename CSPI::channel_tag channel_in_tag
Input channel tag.
Definition dcnnelements.hpp:762
Definition dcnnelements.hpp:1825
static constexpr auto cr
Input image channel range.
Definition dcnnelements.hpp:1862
dcnnsol::feature_data< CSPO, PP > output_data
Output activations.
Definition dcnnelements.hpp:1841
static tagged::range_class< batch_tag > forward_check(const input_data &ind, output_data &outd)
Check argument compatibility for the forward function.
Definition dcnnelements.hpp:1878
typename SPI::width_tag width_in_tag
Input image width.
Definition dcnnelements.hpp:1849
typename SPI::height_tag height_in_tag
Input image height.
Definition dcnnelements.hpp:1848
static constexpr auto hir
Input image height range.
Definition dcnnelements.hpp:1860
typename SPI::channel_tag channel_tag
Input image channel.
Definition dcnnelements.hpp:1850
static constexpr auto wir
Input image width range.
Definition dcnnelements.hpp:1861
static constexpr std::size_t fanin
Number of inputs for each output element.
Definition dcnnelements.hpp:1866
dcnnsol::image_data< SPI, PP > input_data
Input activations.
Definition dcnnelements.hpp:1837
Utility base class for the first normalizing layer.
Definition dcnnelements.hpp:588
static tagged::range_class< batch_tag > forward_check(const input_data &ind, stat_data &cd, output_data &outd)
Argument compatibility check for the forward function.
Definition dcnnelements.hpp:626
typename SP::channel_tag channel_tag
Tag: Channel index.
Definition dcnnelements.hpp:619
static constexpr auto hr
Index range along image height.
Definition dcnnelements.hpp:621
typename SP::height_tag height_tag
Tag: Image height dimension.
Definition dcnnelements.hpp:609
dcnnsol::image_data< SP, PP > output_data
Output activations.
Definition dcnnelements.hpp:604
static constexpr auto cr
Output channel index range [0,1)
Definition dcnnelements.hpp:623
first_stat stat_data
Statistics.
Definition dcnnelements.hpp:600
static constexpr auto wr
Index range along image width.
Definition dcnnelements.hpp:622
batch_data< ISP, CSP > input_data
Input activations.
Definition dcnnelements.hpp:596
typename SP::width_tag width_tag
Tag: Image width dimension.
Definition dcnnelements.hpp:613
Tag: Height dimension of an image.
Definition dcnnelements.hpp:94
Internal layer activation data policy.
Definition dcnnelements.hpp:369
tagged::permute_tensor_class< typename PP::data, float, height_tag, width_tag, channel_tag, batch_tag > values_t
4-dimensional tensor type carrying activations
Definition dcnnelements.hpp:401
static constexpr auto cr
Channel index range, statically sized.
Definition dcnnelements.hpp:394
static constexpr auto hr
Image height range, statically sized.
Definition dcnnelements.hpp:386
tagged::permute_tensor_class< tagged::co_list< typename PP::data >, float, tagged::co< height_tag >, tagged::co< width_tag >, tagged::co< channel_tag >, tagged::co< batch_tag > > co_values_t
4-dimensional tensor type carrying loss derivatives wrt. activations
Definition dcnnelements.hpp:409
static constexpr auto wr
Image width range, statically sized.
Definition dcnnelements.hpp:390
Combined image and channel size policy.
Definition dcnnelements.hpp:352
CSP channel_policy
Channel size policy.
Definition dcnnelements.hpp:360
ISP image_policy
Image size policy.
Definition dcnnelements.hpp:356
Definition dcnnelements.hpp:1755
Utility base class for the image multiply layer.
Definition dcnnelements.hpp:1474
dcnnsol::image_data< SP, PP > output_data
Output activations.
Definition dcnnelements.hpp:1491
static constexpr auto hr
Image height range.
Definition dcnnelements.hpp:1508
typename SP::width_tag width_tag
Image width.
Definition dcnnelements.hpp:1498
typename SP::height_tag height_tag
Image height.
Definition dcnnelements.hpp:1497
static constexpr auto wr
Image width range.
Definition dcnnelements.hpp:1509
dcnnsol::feature_multiplier< CSP, PP > multiplier_data
Model multiplieres.
Definition dcnnelements.hpp:1487
dcnnsol::image_data< SP, PP > input_data
Input activations.
Definition dcnnelements.hpp:1483
typename SP::channel_tag channel_tag
Image channel.
Definition dcnnelements.hpp:1499
static tagged::range_class< batch_tag > forward_check(const input_data &ind, const multiplier_data &cd, output_data &outd)
Check argument compatibility for the forward function.
Definition dcnnelements.hpp:1524
static constexpr auto cr
Image channel range.
Definition dcnnelements.hpp:1510
Utility base class for a normalizing layer.
Definition dcnnelements.hpp:1373
image_normalize_model< CSP > norm_data
Statistics.
Definition dcnnelements.hpp:1384
static constexpr auto cr
Index range along image width.
Definition dcnnelements.hpp:1405
typename SP::height_tag height_tag
Tag: Image height dimension.
Definition dcnnelements.hpp:1393
static constexpr auto hr
Index range along image height.
Definition dcnnelements.hpp:1403
dcnnsol::image_data< SP, PP > output_data
Output activations.
Definition dcnnelements.hpp:1388
typename SP::channel_tag channel_tag
Tag: Channel index.
Definition dcnnelements.hpp:1401
dcnnsol::image_data< SP, PP > input_data
Input activations.
Definition dcnnelements.hpp:1380
typename SP::width_tag width_tag
Tag: Image width dimension.
Definition dcnnelements.hpp:1397
static constexpr auto wr
Index range along image width.
Definition dcnnelements.hpp:1404
Definition dcnnelements.hpp:1674
Utility base class for the image shift layer.
Definition dcnnelements.hpp:1587
static constexpr auto hr
Image height range.
Definition dcnnelements.hpp:1622
dcnnsol::image_data< SP, PP > output_data
Output activations.
Definition dcnnelements.hpp:1605
typename SP::width_tag width_tag
Image width.
Definition dcnnelements.hpp:1612
static constexpr auto cr
Image channel range.
Definition dcnnelements.hpp:1624
static tagged::range_class< batch_tag > forward_check(const input_data &ind, const bias_data &cd, output_data &outd)
Check argument compatibility for the forward function.
Definition dcnnelements.hpp:1638
typename SP::channel_tag channel_tag
Image channel.
Definition dcnnelements.hpp:1613
typename SP::height_tag height_tag
Image height.
Definition dcnnelements.hpp:1611
static constexpr auto wr
Image width range.
Definition dcnnelements.hpp:1623
dcnnsol::feature_bias< CSP, PP > bias_data
Model biases.
Definition dcnnelements.hpp:1601
dcnnsol::image_data< SP, PP > input_data
Input activations.
Definition dcnnelements.hpp:1597
Image size policy.
Definition dcnnelements.hpp:120
height_stag< H > height_tag
Tag: Height dimension of an image, statically sized.
Definition dcnnelements.hpp:124
width_stag< W > width_tag
Tag: Width dimension of an image, statically sized.
Definition dcnnelements.hpp:128
static constexpr tagged::range_class< height_tag > hr
Height range of an image, statically sized.
Definition dcnnelements.hpp:133
static constexpr tagged::range_class< width_tag > wr
Width range of an image, statically sized.
Definition dcnnelements.hpp:137
Tag: Kernel height dimension.
Definition dcnnelements.hpp:162
Tag: Kernel width dimension.
Definition dcnnelements.hpp:169
Loss data policy.
Definition dcnnelements.hpp:445
tagged::tensor_class< float, batch_tag > loss_t
1-dimensional tensor type carrying loss values for images in a minibatch
Definition dcnnelements.hpp:449
Definition dcnnelements.hpp:2089
Definition dcnnelements.hpp:1723
Definition dcnnelements.hpp:1727
Definition dcnnelements.hpp:1739
Definition dcnnelements.hpp:1724
Definition dcnnelements.hpp:1730
Functor to multiply by a constant and add a fixed value.
Definition dcnnelements.hpp:537
Functor to subtract from a fixed value.
Definition dcnnelements.hpp:511
Utility base class for the convolutional layer.
Definition dcnnelements.hpp:998
typename KSP::kernel_width_tag kernel_width_tag
Kernel width.
Definition dcnnelements.hpp:1028
static constexpr conv_iko_map_functor< tagged::selector< height_in_tag >, tagged::selector< kernel_height_tag >, tagged::selector< height_out_tag >, khr.size(), 1 > hikomf
input-height index to kernel-height index to output-height index
Definition dcnnelements.hpp:1093
static constexpr conv_ok_range_functor< tagged::selector< kernel_height_tag >, tagged::selector< height_out_tag >, hir.size(), khr.size(), 1 > hokrf
output-height index to kernel-height range
Definition dcnnelements.hpp:1087
dcnnsol::image_data< SPI, PP > input_data
Input activations.
Definition dcnnelements.hpp:1009
static constexpr auto cor
Output image channel range.
Definition dcnnelements.hpp:1052
static constexpr auto hir
Input image height range.
Definition dcnnelements.hpp:1045
static constexpr auto wir
Input image width range.
Definition dcnnelements.hpp:1046
static constexpr conv_koi_map_functor< tagged::selector< kernel_width_tag >, tagged::selector< width_out_tag >, tagged::selector< width_in_tag >, kwr.size(), 1 > wkoimf
kernel-width index to output-width index to input-width index
Definition dcnnelements.hpp:1100
typename SPI::height_tag height_in_tag
Input image height.
Definition dcnnelements.hpp:1023
static constexpr conv_koi_map_functor< tagged::selector< kernel_height_tag >, tagged::selector< height_out_tag >, tagged::selector< height_in_tag >, khr.size(), 1 > hkoimf
kernel-height index to output-height index to input-height index
Definition dcnnelements.hpp:1098
typename SPI::width_tag width_in_tag
Input image width.
Definition dcnnelements.hpp:1024
static constexpr auto cir
Input image channel range.
Definition dcnnelements.hpp:1047
typename SPO::height_tag height_out_tag
Output image height.
Definition dcnnelements.hpp:1030
static constexpr auto khr
Kernel height range.
Definition dcnnelements.hpp:1048
dcnnsol::image_data< SPO, PP > output_data
Output activations.
Definition dcnnelements.hpp:1017
static tagged::range_class< batch_tag > forward_check(const input_data &ind, const weights &wtd, output_data &outd)
Check argument compatibility for the forward function.
Definition dcnnelements.hpp:1114
static constexpr conv_ko_range_functor< tagged::selector< kernel_height_tag >, tagged::selector< height_out_tag >, hir.size(), khr.size(), 1 > hkorf
kernel-height index to output-height range
Definition dcnnelements.hpp:1097
static constexpr conv_oki_map_functor< tagged::selector< width_in_tag >, tagged::selector< kernel_width_tag >, tagged::selector< width_out_tag >, kwr.size(), 1 > wokimf
output-width index to kernel-width index to input-width index
Definition dcnnelements.hpp:1090
static constexpr conv_ik_range_functor< tagged::selector< width_in_tag >, tagged::selector< kernel_width_tag >, wir.size(), kwr.size(), 1 > wikrf
input-width index to kernel-width range
Definition dcnnelements.hpp:1094
static constexpr conv_ko_range_functor< tagged::selector< kernel_width_tag >, tagged::selector< width_out_tag >, wir.size(), kwr.size(), 1 > wkorf
kernel-width index to output-width range
Definition dcnnelements.hpp:1099
typename SPO::width_tag width_out_tag
Output image width.
Definition dcnnelements.hpp:1031
static constexpr conv_oki_map_functor< tagged::selector< height_in_tag >, tagged::selector< kernel_height_tag >, tagged::selector< height_out_tag >, khr.size(), 1 > hokimf
output-height index to kernel-height index to input-height index
Definition dcnnelements.hpp:1088
static constexpr auto kwr
Kernel width range.
Definition dcnnelements.hpp:1049
static constexpr conv_iko_map_functor< tagged::selector< width_in_tag >, tagged::selector< kernel_width_tag >, tagged::selector< width_out_tag >, kwr.size(), 1 > wikomf
input-width index to kernel-width index to output-width index
Definition dcnnelements.hpp:1095
static constexpr std::size_t fanin
Number of inputs for each output element.
Definition dcnnelements.hpp:1056
typename SPI::channel_tag channel_in_tag
Input image channel.
Definition dcnnelements.hpp:1025
typename KSP::kernel_height_tag kernel_height_tag
Kernel height.
Definition dcnnelements.hpp:1027
typename SPO::channel_tag channel_out_tag
Output image channel.
Definition dcnnelements.hpp:1032
dcnnsol::conv_weights< KSP, CSPI, CSPO, PP > weights
Model weights.
Definition dcnnelements.hpp:1013
static constexpr conv_ok_range_functor< tagged::selector< kernel_width_tag >, tagged::selector< width_out_tag >, wir.size(), kwr.size(), 1 > wokrf
output-width index to kernel-width range
Definition dcnnelements.hpp:1089
static constexpr auto hor
Output image height range.
Definition dcnnelements.hpp:1050
static constexpr conv_ik_range_functor< tagged::selector< height_in_tag >, tagged::selector< kernel_height_tag >, hir.size(), khr.size(), 1 > hikrf
input-height index to kernel-height range
Definition dcnnelements.hpp:1092
static constexpr auto wor
Output image width range.
Definition dcnnelements.hpp:1051
Utility base class for the convolutional layer.
Definition dcnnelements.hpp:1162
static constexpr conv_iko_map_functor< tagged::selector< width_in_tag >, tagged::selector< kernel_width_tag >, tagged::selector< width_out_tag >, kwr.size(), WSTRIDE > wikomf
input-width index to kernel-width index to output-width index
Definition dcnnelements.hpp:1269
static tagged::range_class< batch_tag > forward_check(const input_data &ind, const weights &wtd, output_data &outd)
Check argument compatibility for the forward function.
Definition dcnnelements.hpp:1288
typename SPI::height_tag height_in_tag
Input image height.
Definition dcnnelements.hpp:1187
static constexpr conv_oki_map_functor< tagged::selector< height_in_tag >, tagged::selector< kernel_height_tag >, tagged::selector< height_out_tag >, khr.size(), HSTRIDE > hokimf
output-height index to kernel-height index to input-height index
Definition dcnnelements.hpp:1262
dcnnsol::image_data< SPI, PP > input_data
Input activations.
Definition dcnnelements.hpp:1173
static constexpr auto wor
Output image width range.
Definition dcnnelements.hpp:1212
static constexpr conv_oki_map_functor< tagged::selector< width_in_tag >, tagged::selector< kernel_width_tag >, tagged::selector< width_out_tag >, kwr.size(), WSTRIDE > wokimf
output-width index to kernel-width index to input-width index
Definition dcnnelements.hpp:1264
typename SPI::width_tag width_in_tag
Input image width.
Definition dcnnelements.hpp:1188
static constexpr conv_koi_map_functor< tagged::selector< kernel_height_tag >, tagged::selector< height_out_tag >, tagged::selector< height_in_tag >, khr.size(), HSTRIDE > hkoimf
kernel-height index to output-height index to input-height index
Definition dcnnelements.hpp:1272
static constexpr conv_ko_range_functor< tagged::selector< kernel_width_tag >, tagged::selector< width_out_tag >, wir.size(), kwr.size(), WSTRIDE > wkorf
kernel-width index to output-width range
Definition dcnnelements.hpp:1273
static constexpr conv_ik_range_functor< tagged::selector< height_in_tag >, tagged::selector< kernel_height_tag >, hir.size(), khr.size(), HSTRIDE > hikrf
input-height index to kernel-height range
Definition dcnnelements.hpp:1266
typename KSP::kernel_height_tag kernel_height_tag
Kernel height.
Definition dcnnelements.hpp:1191
typename SPO::channel_tag channel_out_tag
Output image channel.
Definition dcnnelements.hpp:1196
static constexpr auto hor
Output image height range.
Definition dcnnelements.hpp:1211
dcnnsol::image_data< SPO, PP > output_data
Output activations.
Definition dcnnelements.hpp:1181
static constexpr auto wir
Input image width range.
Definition dcnnelements.hpp:1207
static constexpr auto hir
Input image height range.
Definition dcnnelements.hpp:1206
static constexpr conv_ko_range_functor< tagged::selector< kernel_height_tag >, tagged::selector< height_out_tag >, hir.size(), khr.size(), HSTRIDE > hkorf
kernel-height index to output-height range
Definition dcnnelements.hpp:1271
typename SPO::width_tag width_out_tag
Output image width.
Definition dcnnelements.hpp:1195
static constexpr auto kwr
Kernel width range.
Definition dcnnelements.hpp:1210
static constexpr auto khr
Kernel height range.
Definition dcnnelements.hpp:1209
static constexpr auto cor
Output image channel range.
Definition dcnnelements.hpp:1213
typename SPI::channel_tag channel_in_tag
Input image channel.
Definition dcnnelements.hpp:1189
static constexpr conv_koi_map_functor< tagged::selector< kernel_width_tag >, tagged::selector< width_out_tag >, tagged::selector< width_in_tag >, kwr.size(), WSTRIDE > wkoimf
kernel-width index to output-width index to input-width index
Definition dcnnelements.hpp:1274
typename KSP::kernel_width_tag kernel_width_tag
Kernel width.
Definition dcnnelements.hpp:1192
static constexpr auto cir
Input image channel range.
Definition dcnnelements.hpp:1208
static constexpr conv_ik_range_functor< tagged::selector< width_in_tag >, tagged::selector< kernel_width_tag >, wir.size(), kwr.size(), WSTRIDE > wikrf
input-width index to kernel-width range
Definition dcnnelements.hpp:1268
typename SPO::height_tag height_out_tag
Output image height.
Definition dcnnelements.hpp:1194
static constexpr conv_ok_range_functor< tagged::selector< kernel_height_tag >, tagged::selector< height_out_tag >, hir.size(), khr.size(), HSTRIDE > hokrf
output-height index to kernel-height range
Definition dcnnelements.hpp:1261
dcnnsol::conv_weights< KSP, CSPI, CSPO, PP > weights
Model weights.
Definition dcnnelements.hpp:1177
static constexpr conv_iko_map_functor< tagged::selector< height_in_tag >, tagged::selector< kernel_height_tag >, tagged::selector< height_out_tag >, khr.size(), HSTRIDE > hikomf
input-height index to kernel-height index to output-height index
Definition dcnnelements.hpp:1267
static constexpr std::size_t fanin
Number of inputs for each output element.
Definition dcnnelements.hpp:1217
static constexpr conv_ok_range_functor< tagged::selector< kernel_width_tag >, tagged::selector< width_out_tag >, wir.size(), kwr.size(), WSTRIDE > wokrf
output-width index to kernel-width range
Definition dcnnelements.hpp:1263
Tag: Width dimension of an image.
Definition dcnnelements.hpp:98
A wrapped list of tags.
Definition tagged.hpp:182