-
Notifications
You must be signed in to change notification settings - Fork 214
Metrics Add init(Ops) method #337
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
Conversation
… an Ops parameter. This does not address adding an Ops parameter to any call methods.
I am aware of the build failure. For some reason my command line git was out of sync with IntelliJ git, so the new unit tests were never actually executed on my end. They were executed with the old code from the |
…tateException if TF has not been set.
For reference, #179 is probably going to have to wait until tensorflow 2.6 releases for the resource variable gradients, unless we want to provide that API without gradients initially. |
That or the custom gradients PR. |
@JimClarke5 , would it make sense to have only the |
@karllessard the problem with initializing the variables in Also, there would an issue if Obviously, things would be easier with @rnett 's updates, but that may be a while off. |
I checked |
resetStates and result. Also removed Ops from CTORs. Also reworked variable assignment so that there is no need to initialize the variables as I added logic to use a tf.assign on the first pass rather than a tf.assignAdd.
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
@karllessard I got the signer's error again on this branch. All I did was a rebase against master. The rebase was clean with no suggestions to merge. |
The latest push changes the Metric's |
I think it's cause you have the |
@googlebot I consent. |
This PR is being closed and will be replaced with a new PR based on the changes from InitScope that was recently merged. |
This PR modifies
Metrics
to add aninit(Ops)
method from theorg.tensorflow.framework.metrics.impl.Initializable
interface. Also, provided optional CTORS without theOps tf
parameter. This will allow aMetric
instance to be initialized at a later time, once theOps
instance is created, e.g.Model
. This allows theMetric
to be defined without a prior dependency onOps
. There is also anonInit(Consumer<Ops>)
method to register a function that is invoked wheninit(Ops)
is called.This PR does not change any of the logic of the
Metric
classes, other than possibly overriding theinit(Ops)
method to create class specificVariables
.This PR does not modify
Variable
initializers and it is still required to do asession.run()
onresetStates()
before doing any other calls that reference an internalVariable
. This should be resolved after #179 and #327 PRs are merged.I still have not added the
Ops
parameter tocall
methods [call(Ops tf, ...)
], it is still not clear to me what the semantic should be afterinit(Ops)
or a previouscall(Ops tf, ...)
were already invoked, and the internal variables were created under a different scope than theOps tf
now being passed. If we can come to an agreement on the semantics, then I can add it.Right now, the
Metric.init(Ops)
method will just return the originalthis.tf
instance, if not null, and ignore the passed inOps tf
. When called the first time,Metric.init(Ops)
returns a sub-scopedOps
based on the passed inOps
.