swift-apis icon indicating copy to clipboard operation
swift-apis copied to clipboard

Adding Test Cases for Layers in Layer.swift file

Open Shashi456 opened this issue 5 years ago • 7 comments

There are a lot of layers which dont have test cases. I will start with adding test cases for Global Average Pooling and Global Max pooling, yet many are left. I will also try to make a list of which ones do and which ones do not.

Also i thought this could be a good first issue if someone wanted to contribute.

Shashi456 avatar Apr 04 '19 11:04 Shashi456

@dan-zheng can you add a good first issue label to this?

Shashi456 avatar May 23 '19 16:05 Shashi456

I will also try to make a list of which ones do and which ones do not.

Hi @Shashi456 Any update on the list of the layers that have tests and those that don't. I wanted to pick this up

Descartess avatar Jun 21 '19 12:06 Descartess

@Descartess, Haven't gotten around to making it yet. But from the top of my head, TranposedConv2D, Dense, LSTM Cell, BatchNorm, LayerNorm dont have tests yet.

Shashi456 avatar Jun 21 '19 12:06 Shashi456

hi @Shashi456, I've created tests for Dense layer here https://github.com/tensorflow/swift-apis/pull/380

jkrukowski avatar Jul 22 '19 17:07 jkrukowski

I would like to work on this, any update on this?

mohdsanadzakirizvi avatar Oct 29 '19 05:10 mohdsanadzakirizvi

@mohdsanadzakirizvi that's awesome!

In the spirit of teaching to fish, Layers are currently found in Sources/TensorFlow/Layers. The corresponding tests appear to be in LayerTests. After poking through a few files, I found that we define Dropout in Core.swift, but a quick ctrl/cmd-f in LayerTests.swift indicates "Dropout" doesn't appear in the file. I think that would be a great layer to add a couple test cases for.

Note: because Dropout is actually a stochastic operation (i.e. it is not deterministic, and instead depends on randomness) you'll want to think carefully about how to test this. (While you can run the operation and verify some properties about the output that are probabilistically almost always guaranteed to be true, it'd be even better to set the random seed to ensure it's fully deterministic.) Also, be sure to test both the training behavior as well as the inference behavior, as they are different! :-)

I hope that helps, and thank you very much for contributing to S4TF!

saeta avatar Oct 29 '19 14:10 saeta

@mohdsanadzakirizvi you might want to look at #402 as well there are layers which don't have derivative tests.

Shashi456 avatar Oct 29 '19 19:10 Shashi456