Skip to content

Commit 2569a51

Browse files
committed
MaxPool slides extension
1 parent fc47bd5 commit 2569a51

File tree

4 files changed

+18
-11
lines changed

4 files changed

+18
-11
lines changed

code/src/mp_kernel_iterator/kernel.hpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77

88
template <typename T>
99
struct KernelIterator final {
10-
using iterator_category = std::input_iterator_tag;
11-
using difference_type = std::ptrdiff_t;
12-
using value_type = T;
10+
using iterator_category = std::forward_iterator_tag;
1311
using pointer = T*;
1412
using reference = T&;
1513

@@ -31,8 +29,8 @@ struct KernelIterator final {
3129
_data_elem_idx += kernel_position[1];
3230
}
3331

34-
T& operator*() { return _tensor_data[_data_elem_idx]; }
35-
const T& operator*() const { return *(_tensor_data + _data_elem_idx); }
32+
reference operator*() { return _tensor_data[_data_elem_idx]; }
33+
const reference operator*() const { return _tensor_data[_data_elem_idx]; }
3634

3735
bool operator==(const KernelIterator<T>& other) const { return _data_elem_idx == other._data_elem_idx; }
3836

img/max-pool-kernel-iterator.png

115 KB
Loading

img/max-pool-kernel.png

110 KB
Loading

index.html

+15-6
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,12 @@ <h3>The next level&nbsp;&nbsp;&nbsp; <span class="fira accent">#include&lt;range
350350
<section>
351351
<h3>More about ranges</h3>
352352
<a href="https://hannes.hauswedell.net/post/2019/11/30/range_intro/">hannes.hauswedell.net/post/2019/11/30/range_intro</a><br><br>
353-
<a href="https://www.modernescpp.com/index.php/c-20-the-ranges-library">modernescpp.com/index.php/c-20-the-ranges-library</a><br><br>
354-
<a href="https://www.youtube.com/watch?v=d_E-VLyUnzc">https://www.youtube.com/watch?v=d_E-VLyUnzc</a><br><br>
355-
<a href="https://www.youtube.com/watch?v=vJ290qlAbbw">https://www.youtube.com/watch?v=vJ290qlAbbw</a>
353+
<a href="https://www.modernescpp.com/index.php/c-20-the-ranges-library">modernescpp.com/index.php/c-20-the-ranges-library</a><br>
354+
<p class="small">C++20 Ranges in Practice - Tristan Brindle</p>
355+
<a href="https://www.youtube.com/watch?v=d_E-VLyUnzc">youtube.com/watch?v=d_E-VLyUnzc</a><br>
356+
<p class="small">From STL to Ranges: Using Ranges Effectively - Jeff Garland</p>
357+
<a href="https://www.youtube.com/watch?v=vJ290qlAbbw">youtube.com/watch?v=vJ290qlAbbw</a><br><br>
358+
<a href="https://github.com/ericniebler/range-v3">github.com/ericniebler/range-v3</a>
356359
</section>
357360
</section>
358361
<section>
@@ -387,20 +390,26 @@ <h4>(with padding, strides and dilations)</h4>
387390
<section>
388391
<h2>MaxPool</h2>
389392
<img src="img/max_pool_animation.gif" alt="">
390-
<h3 class="fragment">(ugly) code time</h3>
393+
<h4 class="fragment">(ugly) code time</h4>
391394
</section>
392395
<section>
393396
<img src="img/no-raw-loops.png" alt="">
394397
<h2 class="fragment"><span class="fira accent">std::max_element</span></h2>
395398
</section>
396399
<section>
397-
<h2>kernel::end()</h2>
400+
<img src="img/max-pool-kernel.png" alt="">
401+
</section>
402+
<section>
403+
<img src="img/max-pool-kernel-iterator.png" alt="">
404+
</section>
405+
<section>
406+
<h2><span class="fira accent">Kernel::end()</span></h2>
398407
<img src="img/kernel-iterator-end.png" alt="">
399408
</section>
400409
<section>
401410
<h3>MaxPool</h3>
402411
<img src="img/mp-transform.png" alt="">
403-
<h3 class="fragment accent"><span class="fira">std::transform</span></h3>
412+
<h3 class="fragment accent"><span class="fira">std::transform std::max_element</span></h3>
404413
</section>
405414
</section>
406415
<section>

0 commit comments

Comments
 (0)