131 void copy_and_pad_input(
const tensor_t& in, tensor_t& out) {
132 if (params_.pad_type == padding::valid) {
136 tensor_t
buf(in.size());
138 for_i(
true,
buf.size(), [&](
int sample) {
140 buf[sample].resize(params_.in_padded.size());
143 for (serial_size_t c = 0; c < params_.in.depth_; c++) {
144 float_t* pimg = &buf[sample][params_.in_padded.get_index(
145 params_.weight.width_ / 2,
146 params_.weight.height_ / 2, c)];
147 const float_t* pin = &in[sample][params_.in.get_index(0, 0, c)];
149 for (serial_size_t y = 0; y < params_.in.height_; y++) {
150 std::copy(pin, pin + params_.in.width_, pimg);
151 pin += params_.in.width_;
152 pimg += params_.in_padded.width_;
167 if (params_.pad_type == padding::valid) {
173 for_i(
true,
buf.size(), [&](
int sample) {
175 buf[sample].resize(params_.in.size());
177 for (serial_size_t c = 0; c < params_.in.depth_; c++) {
179 &delta[sample][params_.in_padded.get_index(
180 params_.weight.width_ / 2,
181 params_.weight.height_ / 2, c)];
182 float_t *pdst = &buf[sample][params_.in.get_index(0, 0, c)];
184 for (serial_size_t y = 0; y < params_.in.height_; y++) {
185 std::copy(pin, pin + params_.in.width_, pdst);
186 pdst += params_.in.width_;
187 pin += params_.in_padded.width_;
193 delta_unpadded = buf;