GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add pad_type and non-square shape into pooling layers by nyanp · Pull Request #374 · tiny-dnn/tiny-dnn

Add pad_type and non-square shape into pooling layers #374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
nyanp merged 13 commits into master from feat/maxpool
Oct 30, 2016

Uh oh!

There was an error while loading. Please reload this page.

Merged

Add pad_type and non-square shape into pooling layers #374

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit Hold shift + click to select a range
e08876e
Add pad_type and x/y padding/stride parameters
Oct 29, 2016
a668234
move padding from tiny_dnn::core -> tiny_dnn
Oct 29, 2016
14ae4f1
refactor conv_out_length and pool_out_length
Oct 29, 2016
8e13dde
Add tests for max-pooling layer
Oct 29, 2016
9ac91a3
add pad_type and x/y stride to average-pooling layer
Oct 30, 2016
32ba67c
set default padding-mode to pooling layers
Oct 30, 2016
5bb12f6
add gradient-check & fix bug
Oct 30, 2016
84724b5
handle caffe's pooling with different stride, kernel
Oct 30, 2016
07c13d0
Merge remote-tracking branch 'refs/remotes/origin/master' into feat/m…
Oct 30, 2016
38b79d1
delete core::padding
Oct 30, 2016
91c9e04
Fix compiler error & add pool_size into ave_pool
Oct 30, 2016
6e727c3
use default_engine
Oct 30, 2016
5c1a2db
remove garbages
Oct 30, 2016
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
add gradient-check & fix bug
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

nyanp
nyanp committed Oct 30, 2016
commit 5bb12f6d00438f8487532de42c265cfa885ad290

There are no files selected for viewing

45 changes: 45 additions & 0 deletions 45 test/test_average_pooling_layer.h
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,50 @@ TEST(ave_pool, gradient_check) { // sigmoid - cross-entropy
EXPECT_TRUE(nn.gradient_check<loss_func>(test_data.first, test_data.second, epsilon<float_t>(), GRAD_CHECK_ALL));
}

TEST(ave_pool, gradient_check2) { // x-stride
typedef cross_entropy loss_func;
typedef activation::sigmoid activation;
typedef network<sequential> network;

network nn;
nn << fully_connected_layer<activation>(3, 8)
<< average_pooling_layer<activation>(4, 2, 1, 2, 1, 2, 1); // 4x2 => 2x2

const auto test_data = generate_gradient_check_data(nn.in_data_size());
nn.init_weight();

EXPECT_TRUE(nn.gradient_check<loss_func>(test_data.first, test_data.second, epsilon<float_t>(), GRAD_CHECK_ALL));
}

TEST(ave_pool, gradient_check3) { // y-stride
typedef cross_entropy loss_func;
typedef activation::sigmoid activation;
typedef network<sequential> network;

network nn;
nn << fully_connected_layer<activation>(3, 8)
<< average_pooling_layer<activation>(4, 2, 1, 1, 2, 1, 2); // 4x2 => 4x1

const auto test_data = generate_gradient_check_data(nn.in_data_size());
nn.init_weight();

EXPECT_TRUE(nn.gradient_check<loss_func>(test_data.first, test_data.second, epsilon<float_t>(), GRAD_CHECK_ALL));
}

TEST(ave_pool, gradient_check4) { // padding-same
typedef cross_entropy loss_func;
typedef activation::sigmoid activation;
typedef network<sequential> network;

network nn;
nn << average_pooling_layer<activation>(4, 2, 1, 2, 2, 1, 1, padding::same); // 4x2 => 4x1

const auto test_data = generate_gradient_check_data(nn.in_data_size());
nn.init_weight();

EXPECT_TRUE(nn.gradient_check<loss_func>(test_data.first, test_data.second, epsilon<float_t>(), GRAD_CHECK_ALL));
}

TEST(ave_pool, forward) {
average_pooling_layer<identity> l(4, 4, 1, 2);
vec_t in = {
Expand Down Expand Up @@ -108,4 +152,5 @@ TEST(ave_pool, read_write) {
serialization_test(l1, l2);
}


} // namespace tiny-dnn
4 changes: 2 additions & 2 deletions 4 tiny_dnn/layers/average_pooling_layer.h
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ class average_pooling_layer : public partial_connected_layer<Activation> {
cnn_size_t x,
cnn_size_t y,
cnn_size_t inc) {
cnn_size_t dymax = std::min(pooling_size_x, in_.height_ - y);
cnn_size_t dxmax = std::min(pooling_size_y, in_.width_ - x);
cnn_size_t dymax = std::min(pooling_size_y, in_.height_ - y);
cnn_size_t dxmax = std::min(pooling_size_x, in_.width_ - x);
cnn_size_t dstx = x / stride_x_;
cnn_size_t dsty = y / stride_y_;
cnn_size_t outidx = out_.get_index(dstx, dsty, inc);
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.