maxpool2d_bwd_fp32.cpp 2.33 KB
Newer Older
rocking's avatar
rocking committed
1
// SPDX-License-Identifier: MIT
rocking's avatar
rocking committed
2
// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.
rocking's avatar
rocking committed
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

#include <iostream>

#include "ck/ck.hpp"
#include "ck/tensor_operation/gpu/device/tensor_layout.hpp"
#include "ck/utility/reduction_enums.hpp"

#include "maxpool2d_bwd_common.hpp"

using InDataType      = float;
using OutDataType     = float;
using IndexDataType   = int32_t;
using ComputeDataType = float;
using DInDataType     = float;
using DOutDataType    = float;

using InLayout  = ck::tensor_layout::convolution::NHWC;
using OutLayout = ck::tensor_layout::convolution::NHWC;

static constexpr bool PropagateNan = false;

int main()
{
    bool do_verification = true;
    bool time_kernel     = false;

    // Pool shape
rocking's avatar
rocking committed
30
31
32
33
34
35
36
37
38
39
40
41
    ck::index_t N               = 1;
    ck::index_t C               = 1;
    ck::index_t Y               = 2;
    ck::index_t X               = 2;
    ck::index_t Hi              = 31;
    ck::index_t Wi              = 31;
    ck::index_t window_stride_h = 2;
    ck::index_t window_stride_w = 2;
    ck::index_t in_left_pad_h   = 0;
    ck::index_t in_left_pad_w   = 0;
    ck::index_t in_right_pad_h  = 1;
    ck::index_t in_right_pad_w  = 1;
rocking's avatar
rocking committed
42
43
44
45
46
47
48
49
50

    bool pass = maxpool_bwd_test<InDataType,
                                 OutDataType,
                                 IndexDataType,
                                 ComputeDataType,
                                 DInDataType,
                                 DOutDataType,
                                 InLayout,
                                 OutLayout,
rocking's avatar
rocking committed
51
52
53
54
55
56
57
58
59
60
61
62
63
64
                                 PropagateNan>(do_verification,
                                               time_kernel,
                                               N,
                                               C,
                                               Y,
                                               X,
                                               Hi,
                                               Wi,
                                               window_stride_h,
                                               window_stride_w,
                                               in_left_pad_h,
                                               in_left_pad_w,
                                               in_right_pad_h,
                                               in_right_pad_w);
rocking's avatar
rocking committed
65
66
67

    return (pass ? 0 : 1);
}