Skip to content

fix max-pool & full-connected layer problem when using nnpack#398

Merged
edgarriba merged 8 commits into
tiny-dnn:masterfrom
azsane:master
Nov 23, 2016
Merged

fix max-pool & full-connected layer problem when using nnpack#398
edgarriba merged 8 commits into
tiny-dnn:masterfrom
azsane:master

Conversation

@azsane

@azsane azsane commented Nov 12, 2016

Copy link
Copy Markdown
Contributor
  • make max-pool layer work using nnpack and test
  • make full-connected layer work using nnpack and test
  • add a stride size !=2 pool size !=2 test for max-pool

code modified pass the test for max-pool & full-connected layer

@edgarriba edgarriba self-assigned this Nov 12, 2016
@thematrixincendies

thematrixincendies commented Nov 12, 2016

Copy link
Copy Markdown

Unfortunately I get totally different results from FC layer with NNPack than with tinydnn backend. And using maxpool crashes my application inside a fc layer (does not matter if tinydnn or nnpack backend) that comes after a maxpool. Conv layer (nnpack) after a nnpack maxpool does not crash.

@edgarriba

Copy link
Copy Markdown
Member

@Kamairo could you open a ticket for this specific issue? Report backtrace and so on. Thx!

@azsane

azsane commented Nov 22, 2016

Copy link
Copy Markdown
Contributor Author

@edgarriba the conflict in maxpool_op_nnpack.h is solved

@edgarriba

Copy link
Copy Markdown
Member

@azsane cool! just fix style typo that I pointed out in my review and we'll be good to merge. Also notice https://github.com/tiny-dnn/tiny-dnn/pull/416/files#diff-26d451c6b2b93a9e871ebcc919d1488bR98

@azsane

azsane commented Nov 22, 2016

Copy link
Copy Markdown
Contributor Author

@edgarriba I didn't find review in 398...so I just modified some variables like #416

and the thing should be noticed is that conv has changed to nnp_convolution_output?

float* output_ptr = reinterpret_cast<float*>(&out_data[0]);
const float* kernel_ptr = W.data();
const float* input_ptr = in_data[0].data();
float* output_ptr =out_data[0].data();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@azsane fix typo error here

pthreadpool_destroy(threadpool);

// TODO: find a proper way to do this
output_ptr =out_data[0].data();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo error

throw nn_error("NNPACK Max-Pool requires a pool size == 2.");
}

*/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@azsane ok, if we are pretty sure of this just remove it and keep your comment


const auto status =
nnp_max_pooling_output(
1,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@azsane as I see from the documentation this one represents the batch_size.
Could you add any comment or todo here in order to handle a bigger batch size in a future?

#ifdef CNN_USE_NNPACK
TEST(fully_connected, forward_nnp)
{
nnp_initialize();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@azsane do you think that we could call this during the layer instantiation?

TEST(max_pool, forward_stride_nnp_not_2x2) {
nnp_initialize();
max_pooling_layer<identity> l(4, 4, 1, 3, 1,
core::backend_t::nnpack);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo error: one space missing

@edgarriba

Copy link
Copy Markdown
Member

@azsane it's fine. I'll fix typos myself. Please could you check why nnp_convolution_inference breaks the tests?

@azsane

azsane commented Nov 23, 2016

Copy link
Copy Markdown
Contributor Author

@edgarriba I just ran the conv test with latest master branch,and all passed.
Do you mean the newly modified code in #416 ?

@edgarriba edgarriba merged commit 0fef100 into tiny-dnn:master Nov 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants