2222import org .tensorflow .ndarray .Shape ;
2323import org .tensorflow .op .Op ;
2424import org .tensorflow .op .Ops ;
25- import org .tensorflow .op .random .RandomUniform ;
2625import org .tensorflow .types .TFloat32 ;
2726import org .tensorflow .types .TFloat64 ;
2827import org .tensorflow .types .TInt32 ;
@@ -39,11 +38,11 @@ public void testValueIsIdempotent() {
3938 Precision <TFloat64 > instance =
4039 new Precision <>(new float [] {0.3f , 0.72f }, 1001L , TFloat64 .class );
4140 Operand <TFloat32 > predictions =
42- tf .random .randomUniform (
43- tf .constant (Shape .of (10 , 3 )), TFloat32 . class , RandomUniform . seed ( 1001L ) );
41+ tf .random .statelessRandomUniform (
42+ tf .constant (Shape .of (10 , 3 )), tf . constant ( new long [] { 1001L , 0L }), TFloat32 . class );
4443 Operand <TFloat32 > labels =
45- tf .random .randomUniform (
46- tf .constant (Shape .of (10 , 3 )), TFloat32 . class , RandomUniform . seed ( 1001L ) );
44+ tf .random .statelessRandomUniform (
45+ tf .constant (Shape .of (10 , 3 )), tf . constant ( new long [] { 1001L , 0L }), TFloat32 . class );
4746
4847 Op update = instance .updateState (tf , labels , predictions , null );
4948
@@ -81,7 +80,11 @@ public void testUnweightedAllIncorrect() {
8180 Precision <TFloat32 > instance = new Precision <>(0.5f , 1001L , TFloat32 .class );
8281
8382 Operand <TInt32 > predictions =
84- tf .random .randomUniformInt (tf .constant (Shape .of (100 , 1 )), tf .constant (0 ), tf .constant (2 ));
83+ tf .random .statelessMultinomial (
84+ tf .constant (new float [][] {{0.5f , 0.5f }}),
85+ tf .constant (100 ),
86+ tf .constant (new long [] {1001L , 0L }),
87+ TInt32 .class );
8588 Operand <TInt32 > labels = tf .math .sub (tf .constant (1 ), predictions );
8689 Op update = instance .updateState (tf , labels , predictions , null );
8790 session .run (update );
0 commit comments