Skip to content

Commit

Permalink
Merge pull request #10 from Catminusminus/conv_layer
Browse files Browse the repository at this point in the history
remove a comment
  • Loading branch information
Catminusminus authored Dec 21, 2019
2 parents a097de8 + 59b5b7b commit c1cefbe
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions scenn/experimental/util/im2col.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,6 @@ namespace scenn::experimental {
template <std::size_t F, std::size_t O, std::size_t Stride, std::size_t Pad,
std::size_t L, std::size_t M, std::size_t N, class T>
SCENN_CONSTEXPR auto im2col1d(const Tensor3D<L, M, N, T>& tensor) {
/**
static_assert(O == (M - F + 2 * Pad) / Stride + 1);
const auto pad_tensor = pad<Pad>(tensor);
// constexpr auto O = (M - F + 2 * Pad) / Stride + 1;
Matrix<N * F, L * O, T> ret;
// Todo: implement constexpr N-dim Tensor and use it
T data[L][N][F][O] = {};
for (std::size_t j = 0; j < F; ++j)
for (std::size_t zero_i = 0; zero_i < L; ++zero_i)
for (std::size_t one_i = 0; one_i < N; ++one_i)
for (std::size_t three_i = 0; three_i < O; ++three_i)
data[zero_i][one_i][j][three_i] =
pad_tensor(zero_i, j + three_i * Stride, one_i);
T transposed_data[N][F][L][O] = {};
for (std::size_t zero_i = 0; zero_i < L; ++zero_i)
for (std::size_t one_i = 0; one_i < N; ++one_i)
for (std::size_t three_i = 0; three_i < F; ++three_i)
for (std::size_t four_i = 0; four_i < O; ++four_i)
transposed_data[one_i][three_i][zero_i][four_i] =
data[zero_i][one_i][three_i][four_i];
for (std::size_t zero_i = 0; zero_i < N; ++zero_i)
for (std::size_t one_i = 0; one_i < F; ++one_i)
for (std::size_t two_i = 0; two_i < L; ++two_i)
for (std::size_t three_i = 0; three_i < O; ++three_i)
ret(zero_i * N + one_i, two_i * L + three_i) =
transposed_data[zero_i][one_i][two_i][three_i];
return ret;
*/
static_assert(O == (N - F + 2 * Pad) / Stride + 1);
const auto pad_tensor = pad<Pad>(tensor);

Expand Down

0 comments on commit c1cefbe

Please sign in to comment.