Conversation
Sync with master tensorflow on upstream
Merge main branch to local branch
Update after losses merge
Fix Javadoc errors (tensorflow#152)
pull type def
Metrics Phase 1 (tensorflow#180)
Pull latest tensorflow master
Change float attributes to double
| * | ||
| * @param <T> the date type for the weights | ||
| */ | ||
| public abstract class Constraint<T extends TNumber> { |
There was a problem hiding this comment.
Does an instance of Constraint need to be specialized to a particular tensor type?
| * @return the element-wise square root. | ||
| */ | ||
| protected Operand<T> sqrt(Operand<T> x) { | ||
| Class<T> type = x.type(); |
There was a problem hiding this comment.
Verify x not null as we do in clip?
| private final int[] axes; | ||
|
|
||
| /** | ||
| * Create a MaxNorm constraint using {@link #MIN_VALUE_DEFAULT} for the min value, {@link |
There was a problem hiding this comment.
MaxNorm -> MinMaxNorm in all constructor header comments
| weights, | ||
| tf.math.add( | ||
| cast(tf, tf.constant(EPSILON), type), | ||
| sqrt( |
There was a problem hiding this comment.
This computation of the norms keeps coming up. Perhaps add a superclass method for it?
| ReduceSum.keepDims(Boolean.TRUE))))); | ||
| } | ||
|
|
||
| /** |
There was a problem hiding this comment.
We have three instances of this axis-management so far. I could imagine adding a superclass like AbstractNormConstraint to handle it. (But I could go either way.)
There was a problem hiding this comment.
Right now, there are only 3 Constraint classes that use it. I don't think another class is warranted.
| for (AtomicInteger i = new AtomicInteger(); | ||
| i.get() < testValues.length; | ||
| i.getAndIncrement()) { | ||
| MinMaxNorm<TFloat32> instance = |
There was a problem hiding this comment.
From this point forward, the test is erroneously a copy of MinMaxNormTest.
There was a problem hiding this comment.
My mistake, I'll fix.
| for (AtomicInteger i = new AtomicInteger(); | ||
| i.get() < testValues.length; | ||
| i.getAndIncrement()) { | ||
| MaxNorm<TFloat32> instance = new MaxNorm<>(tf, testValues[i.get()]); |
There was a problem hiding this comment.
Erroneously a copy of MaxNormTest.
There was a problem hiding this comment.
My mistake, I'll fix.
| return result; | ||
| } | ||
|
|
||
| /** Test of call method, of class MaxNorm. */ |
There was a problem hiding this comment.
MaxNorm -> UnitNorm (not just in the comment, but in the code)
There was a problem hiding this comment.
My mistake, I'll fix.
Add norm method on Constraint that is leveraged by the xxxxNorm constraints. Fix unit test cases to properly test the actual classes (oops). Fix Javadoc
karllessard
left a comment
There was a problem hiding this comment.
All right this one is ready to to, thanks @JimClarke5 and thanks @deansher for reviewing it!
Adding Constraints.
Constraints impose constraints on weight values.
This does not include the RadialConstraint as that requires
whileoperations.This should be independent class that do not have dependencies on other framework packages.