test: more gradient optimizer tests#1217
Merged
Oceania2018 merged 6 commits intoSciSharp:masterfrom Jun 19, 2024
Merged
Conversation
test/TensorFlowNET.UnitTest/Training/GradientDescentOptimizerTests.cs
Outdated
Show resolved
Hide resolved
| Tuple.Create(grads1, var1 as IVariableV1) | ||
| }; | ||
| var sgd_op = tf.train.GradientDescentOptimizer(3.0f) | ||
| .apply_gradients(grads_and_vars, global_step: global_step); |
Contributor
Author
There was a problem hiding this comment.
@AsakusaRinne why does apply_gradiens take System.Tuple while zip produces (T1, T2). Would it be better to replace or extend apply_gradients interface to support valuetuple as well?
9308d67 to
1f3f39e
Compare
1f3f39e to
d54f7a6
Compare
| // Validate updated params | ||
| var np_pred = 1.0 * 4.0 + 2.0 * 5.0 + 3.0; | ||
| var np_grad = 2 * np_pred; | ||
| self.assertAllCloseAccordingToType( |
Contributor
Author
There was a problem hiding this comment.
@Wanglongzhi2001 Hm, now it calculates but the test doesn't pass. However, the code corresponds to TensorFlow original test. I have to check math there.
Contributor
Author
There was a problem hiding this comment.
There just was a small typo, but I didn't have time to debug it :-D
Contributor
Author
|
Hi @AsakusaRinne @Wanglongzhi2001 @Oceania2018 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.