"include/vscode:/vscode.git/clone" did not exist on "334361cbde76a2566fb215a64a6652205b0d2336"
wrapper.rst 1.37 KB
Newer Older
Bartlomiej Kocot's avatar
Bartlomiej Kocot committed
1
2
3
4
5
6
7
===============
Wrapper
===============

-------------------------------------
Description
-------------------------------------
Bartlomiej Kocot's avatar
Bartlomiej Kocot committed
8
9
10
11
12

.. note::

    The wrapper is under development and its functionality is limited.

Bartlomiej Kocot's avatar
Bartlomiej Kocot committed
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

CK provides a lightweight wrapper for more complex operations implemented in 
the library. It allows indexing of nested layouts using a simple interface 
(avoiding complex descriptor transformations). 

Example:

.. code-block:: c

    const auto shape_4x2x4         = ck::make_tuple(4, ck::make_tuple(2, 4));
    const auto strides_s2x1x8      = ck::make_tuple(2, ck::make_tuple(1, 8));
    const auto layout = ck::wrapper::make_layout(shape_4x2x4, strides_s2x1x8);

    std::cout << "dims:4,(2,4) strides:2,(1,8)" << std::endl;
    for(ck::index_t h = 0; h < ck::wrapper::size<0>(layout); h++)
    {
        for(ck::index_t w = 0; w < ck::wrapper::size<1>(layout); w++)
        {
            std::cout << layout(ck::make_tuple(h, w)) << " ";
        }
        std::cout << std::endl;
    }

Output::

    dims:4,(2,4) strides:2,(1,8)
    0 1 8 9 16 17 24 25 
    2 3 10 11 18 19 26 27 
    4 5 12 13 20 21 28 29 
    6 7 14 15 22 23 30 31 

-------------------------------------
Layout
-------------------------------------

.. doxygenstruct:: ck::wrapper::Layout

-------------------------------------
Layout helpers
-------------------------------------

.. doxygenfile:: layout_utils.hpp