test_softmax_ut_cases.inc 1.34 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
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
55
56
57
58
59
60
#pragma once

TYPED_TEST(TestSoftmax, ReduceOutermostDim)
{
    std::vector<ck::index_t> reduce_dims{this->Rank - 1};
    this->Run(reduce_dims);
}

TYPED_TEST(TestSoftmax, ReduceMiddleDim)
{
    for(int dim = 0; dim < this->Rank - 1; ++dim)
    {
        std::vector<ck::index_t> reduce_dims{dim};
        this->Run(reduce_dims);
    }
}

TYPED_TEST(TestSoftmax, ReduceMultipleDimsWithOutermost)
{
    for(int dim = 0; dim < this->Rank - 1; ++dim)
    {
        std::vector<ck::index_t> reduce_dims{dim, this->Rank - 1};
        this->Run(reduce_dims);
    }
}

TYPED_TEST(TestSoftmax, ReduceMultipleMiddleDims)
{
    std::vector<ck::index_t> reduce_dims{0, 1};
    if(this->Rank >= 3)
    {
        this->Run(reduce_dims);
    }

    if(this->Rank >= 4)
    {
        reduce_dims = std::vector<ck::index_t>{0, 2};
        this->Run(reduce_dims);
        reduce_dims = std::vector<ck::index_t>{0, 1, 2};
        this->Run(reduce_dims);
    }
}

TYPED_TEST(TestSoftmax, ReduceAllDims)
{
    std::vector<ck::index_t> reduce_dims(this->Rank);
    std::iota(std::begin(reduce_dims), std::end(reduce_dims), 0);
    this->Run(reduce_dims);
}

TYPED_TEST(TestSoftmax, ReduceOddLengths)
{
    this->in_lengths_ = {{3, 63, 1032}};
    if(this->Rank >= 4)
    {
        this->in_lengths_ = {{1, 3, 63, 1032}};
    }
    this->Run({this->Rank - 1});
    this->Run({this->Rank - 2});
}