31#ifndef REMORA_KERNELS_CONV2D_HPP
32#define REMORA_KERNELS_CONV2D_HPP
36#ifdef REMORA_USE_CLBLAST
40namespace remora{
namespace kernels{
58template<
class E1,
class E2,
class M,
class Device>
60 matrix_expression<E1, Device>
const& images,
61 vector_expression<E2, Device>
const& filter,
62 matrix_expression<M, Device>& outputs,
63 std::size_t num_channels,
64 std::size_t num_filters,
65 std::size_t image_height,
66 std::size_t image_width,
67 std::size_t filter_height,
68 std::size_t filter_width,
69 std::size_t padding_height = 0,
70 std::size_t padding_width = 0
72 std::size_t output_rows_per_filter = (image_height - filter_height +1 + padding_height) * (image_width - filter_width +1 + padding_width);
73 std::size_t filter_size = filter_width * filter_height * num_channels;
75 REMORA_SIZE_CHECK(outputs().size1() == images().size1());
76 REMORA_SIZE_CHECK(outputs().size2() == num_filters * output_rows_per_filter);
77 REMORA_SIZE_CHECK(images().size2() == num_channels * image_width * image_height);
78 REMORA_SIZE_CHECK(filter().size() == num_filters * filter_size);
81 images, filter, outputs, num_channels, num_filters,
82 image_height, image_width, filter_height, filter_width,
83 padding_height, padding_width