swift-apis
swift-apis copied to clipboard
Adding Test Cases for Layers in Layer.swift file
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.
@dan-zheng can you add a good first issue label to this?
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, 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.
hi @Shashi456, I've created tests for Dense
layer here https://github.com/tensorflow/swift-apis/pull/380
I would like to work on this, any update on this?
@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!
@mohdsanadzakirizvi you might want to look at #402 as well there are layers which don't have derivative tests.