Skip to content

Add 'test mode' to dropout component#1578

Merged
danpovey merged 2 commits intokaldi-asr:kaldi_52from
freewym:kaldi_52
Apr 26, 2017
Merged

Add 'test mode' to dropout component#1578
danpovey merged 2 commits intokaldi-asr:kaldi_52from
freewym:kaldi_52

Conversation

@freewym
Copy link
Contributor

@freewym freewym commented Apr 25, 2017

For issue #1570. Failure on derivative test need to be resolved.

Copy link
Contributor

@danpovey danpovey left a comment

Choose a reason for hiding this comment

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

Minor comments but please do this right away, as I want to make some other changes that will conflict with these, and I'd rather start from your PR.

bool ok = cfl->GetValue("dim", &dim) &&
cfl->GetValue("dropout-proportion", &dropout_proportion);
cfl->GetValue("dropout-per-frame", &dropout_per_frame);
cfl->GetValue("test-mode", &test_mode_);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you comment here that it only makes sense to set test-mode in the config for testing purposes?

BaseFloat dropout = dropout_proportion_;
KALDI_ASSERT(dropout >= 0.0 && dropout <= 1.0);
if (test_mode_) {
out->Set(1.0 - dropout);
Copy link
Contributor

Choose a reason for hiding this comment

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

This would not work correctly for in-place propagation, if we ever change the code to make that possible, so I think it would be nicer to replace this code with:

  out->CopyFromMat(in);
  out->Scale(1.0  - dropout);
  return NULL;

@freewym
Copy link
Contributor Author

freewym commented Apr 26, 2017

Done

@freewym freewym changed the title WIP: Add 'test mode' to dropout component Add 'test mode' to dropout component Apr 26, 2017
@danpovey danpovey merged commit 4fd7f00 into kaldi-asr:kaldi_52 Apr 26, 2017
@danpovey
Copy link
Contributor

@hhadian, I haven't really done any testing of this, but I'm hoping you can help with scripting and testing it in the CIFAR setup.
In your Keras-based recipes, where is the dropout applied? I.e. on which layers?

@freewym freewym deleted the kaldi_52 branch April 26, 2017 03:42
@hhadian
Copy link
Contributor

hhadian commented Apr 26, 2017

Sure. Do you want me to prepare another script in local/nnet3 to test it on CIFAR?
The dropout is applied after ReLU activations (or after max-pooling which itself is applied on CNN). I.e. In the recipe I'm using it is either CNN -> ReLU -> MaxPool -> Dropout or FullyConnected -> ReLU -> Dropout

@danpovey
Copy link
Contributor

danpovey commented Apr 26, 2017 via email

@hhadian
Copy link
Contributor

hhadian commented Apr 26, 2017

OK. Will do.

Skaiste pushed a commit to Skaiste/idlak that referenced this pull request Sep 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants