|
| 1 | +/******************************************************************************* |
| 2 | + * |
| 3 | + * MIT License |
| 4 | + * |
| 5 | + * Copyright (c) 2024 Advanced Micro Devices, Inc. |
| 6 | + * |
| 7 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 8 | + * of this software and associated documentation files (the "Software"), to deal |
| 9 | + * in the Software without restriction, including without limitation the rights |
| 10 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 11 | + * copies of the Software, and to permit persons to whom the Software is |
| 12 | + * furnished to do so, subject to the following conditions: |
| 13 | + * |
| 14 | + * The above copyright notice and this permission notice shall be included in all |
| 15 | + * copies or substantial portions of the Software. |
| 16 | + * |
| 17 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 20 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 22 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 23 | + * SOFTWARE. |
| 24 | + * |
| 25 | + *******************************************************************************/ |
| 26 | +#include "conv_common.hpp" |
| 27 | + |
| 28 | +template <class T> |
| 29 | +struct conv2d_driver : conv_driver<T, ConvApi::Immediate> |
| 30 | +{ |
| 31 | + conv2d_driver() : conv_driver<T, ConvApi::Immediate>() |
| 32 | + { |
| 33 | + this->add(this->input_dims, "input"); |
| 34 | + this->add(this->weight_tensor_dims, "weights"); |
| 35 | + this->add(this->batch_size, |
| 36 | + "batch_size", |
| 37 | + this->generate_data_limited(this->get_batch_sizes(), 1, {16})); |
| 38 | + this->add(this->input_channels, |
| 39 | + "input_channels", |
| 40 | + this->generate_data_limited(this->get_input_channels(), 1, {32})); |
| 41 | + this->add(this->output_channels, |
| 42 | + "output_channels", |
| 43 | + this->generate_data_limited(this->get_output_channels(), 1, {32})); |
| 44 | + this->add(this->spatial_dim_elements, |
| 45 | + "spatial_dim_elements", |
| 46 | + this->generate_data_limited(this->get_2d_spatial_dims(), 1, {56, 56})); |
| 47 | + this->add(this->filter_dims, |
| 48 | + "filter_dims", |
| 49 | + this->generate_data_limited(this->get_2d_filter_dims(), 2, {3, 3})); |
| 50 | + this->add(this->pads_strides_dilations, |
| 51 | + "pads_strides_dilations", |
| 52 | + this->generate_data_limited(this->get_2d_pads_strides_dilations(), 2)); |
| 53 | + this->add(this->trans_output_pads, |
| 54 | + "trans_output_pads", |
| 55 | + this->generate_data_limited(this->get_2d_trans_output_pads(), 1)); |
| 56 | + this->add(this->in_layout, "in_layout", this->generate_data({"NCHW"})); |
| 57 | + this->add(this->fil_layout, "fil_layout", this->generate_data({"NCHW"})); |
| 58 | + this->add(this->out_layout, "out_layout", this->generate_data({"NCHW"})); |
| 59 | + } |
| 60 | +}; |
0 commit comments