-
Notifications
You must be signed in to change notification settings - Fork 214
Initial checkin of Keras Optimzers and helper classes. #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 19 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
ef0ce67
Initial checkin of Keras Optimzers and helper classes.
JimClarke5 9c113a7
Added static final NAME to replace hardcoded String in the create met…
JimClarke5 824d487
Changed of method to use the DataType NAME attribute rather than hard…
JimClarke5 07a83a5
Added method WriteFieldWithInitializer to output a "final static Stri…
JimClarke5 3d26831
Added tf.nn.softmaxCrossEntropyWitLogits() and tf.nn.raw.softmaxCross…
JimClarke5 11cda5f
Moved SoftmaxCrossEntropyWithLogits and SparseSoftmaxCrossEntropyWit…
JimClarke5 9c7dfaa
Generated classes now have public static final String OP_NAME = "XXXX…
JimClarke5 84f49db
Generated classes now have public static final String OP_NAME = "XXXX…
JimClarke5 208b84a
fix dependencies for other Tensorflow Java modules
JimClarke5 3913161
formatting fix
JimClarke5 b5a7c0f
Fix ctors with name to properly pass the name to the the super ctor.
JimClarke5 fcba0a5
change asserts to IllegalArgumentException
JimClarke5 960cfc3
change asserts to IllegalArgumentException
JimClarke5 d37298a
Moved back to tests
JimClarke5 c68812c
Moved SoftmaxCrossEntropyWithLogits.java and SparseSoftmaxCrossEntrop…
JimClarke5 6b8eb26
Deleted files that are not necessary yet
JimClarke5 6515c24
Added nn.raw group for softmaxCrossEntropyWithLogits() and sparseSoft…
JimClarke5 76d0fe5
Added nn.raw group for softmaxCrossEntropyWithLogits() and sparseSoft…
JimClarke5 d2201df
Merge branch 'master' into master
JimClarke5 ab379d1
Refactor NN into individual operations under org.tensorflow.op.nn. Fi…
JimClarke5 889d67e
Refactor NN into individual operations under org.tensorflow.op.nn. Fi…
JimClarke5 515b799
Reformatted code
JimClarke5 5a9fe37
Added sub scope
JimClarke5 8d21dd7
Miscellaneous fixes based on review comments.
JimClarke5 4c3cc78
Fixed op_generator.cc to remove a spurious new line in the generated …
JimClarke5 44f530f
Changed back to non-generic Operand until we resolve how to handle ge…
JimClarke5 b8d3ac2
Regenerated due to creation of SoftmaxCrossEntropyWithLogits.java, S…
JimClarke5 c32fc5b
change snake case to camel case. format code
JimClarke5 171cd2f
clean upd warning, format code
JimClarke5 e9c3134
Added Adamax, Ftrl, and Nadam Optimizers. Added Optimizers enum for e…
JimClarke5 5c30a72
Removed optimize classes from tensorflow-keras, moved optimizer test …
JimClarke5 ebefc2e
Fixed generics
JimClarke5 7915e63
Fixed from Unit test results
JimClarke5 ec4f679
added @SuppressWarnings("unchecked") on Variable array
JimClarke5 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...ow-core/tensorflow-core-api/src/bazel/api_def/api_def_SoftmaxCrossEntropyWithLogits.pbtxt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
op { | ||
graph_op_name: "SoftmaxCrossEntropyWithLogits" | ||
endpoint { | ||
name: "nn.SoftmaxCrossEntropyWithLogits" | ||
name: "nn.raw.SoftmaxCrossEntropyWithLogits" | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...e/tensorflow-core-api/src/bazel/api_def/api_def_SparseSoftmaxCrossEntropyWithLogits.pbtxt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
op { | ||
graph_op_name: "SparseSoftmaxCrossEntropyWithLogits" | ||
endpoint { | ||
name: "nn.SparseSoftmaxCrossEntropyWithLogits" | ||
name: "nn.raw.SparseSoftmaxCrossEntropyWithLogits" | ||
} | ||
} |
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
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
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
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
74 changes: 74 additions & 0 deletions
74
tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/NnRawOps.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// Copyright 2020 The TensorFlow Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ============================================================================== | ||
// | ||
// This class has been generated, DO NOT EDIT! | ||
// | ||
package org.tensorflow.op; | ||
|
||
import org.tensorflow.Operand; | ||
import org.tensorflow.op.nn.raw.SoftmaxCrossEntropyWithLogits; | ||
import org.tensorflow.op.nn.raw.SparseSoftmaxCrossEntropyWithLogits; | ||
import org.tensorflow.types.family.TNumber; | ||
|
||
/** | ||
* An API for building {@code nn.raw} operations as {@link Op Op}s | ||
* | ||
* @see {@link Ops} | ||
*/ | ||
public final class NnRawOps { | ||
private final Scope scope; | ||
|
||
NnRawOps(Scope scope) { | ||
this.scope = scope; | ||
} | ||
|
||
/** | ||
* Computes softmax cross entropy cost and gradients to backpropagate. | ||
* <p> | ||
* Inputs are the logits, not probabilities. | ||
* | ||
* @param <T> data type for {@code loss()} output | ||
* @param features batch_size x num_classes matrix | ||
* @param labels batch_size x num_classes matrix | ||
* The caller must ensure that each batch of labels represents a valid | ||
* probability distribution. | ||
* @return a new instance of SoftmaxCrossEntropyWithLogits | ||
*/ | ||
public <T extends TNumber> SoftmaxCrossEntropyWithLogits<T> softmaxCrossEntropyWithLogits( | ||
Operand<T> features, Operand<T> labels) { | ||
return SoftmaxCrossEntropyWithLogits.create(scope, features, labels); | ||
} | ||
|
||
/** | ||
* Computes softmax cross entropy cost and gradients to backpropagate. | ||
* <p> | ||
* Unlike `SoftmaxCrossEntropyWithLogits`, this operation does not accept | ||
* a matrix of label probabilities, but rather a single label per row | ||
* of features. This label is considered to have probability 1.0 for the | ||
* given row. | ||
* <p> | ||
* Inputs are the logits, not probabilities. | ||
* | ||
* @param <T> data type for {@code loss()} output | ||
* @param features batch_size x num_classes matrix | ||
* @param labels batch_size vector with values in [0, num_classes). | ||
* This is the label for the given minibatch entry. | ||
* @return a new instance of SparseSoftmaxCrossEntropyWithLogits | ||
*/ | ||
public <T extends TNumber, U extends TNumber> SparseSoftmaxCrossEntropyWithLogits<T> sparseSoftmaxCrossEntropyWithLogits( | ||
Operand<T> features, Operand<U> labels) { | ||
return SparseSoftmaxCrossEntropyWithLogits.create(scope, features, labels); | ||
} | ||
} |
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
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: when there are no fields to write after this, it creates one extra empty line. We can avoid it by adding
EndLine()
only ifop.outputs()
is not empty: