@@ -1176,25 +1176,28 @@ describeWithFlags('truncatedNormal', ALL_ENVS, () => {
11761176 } ) ;
11771177} ) ;
11781178
1179+ const GAMMA_MIN = 0 ;
1180+ const GAMMA_MAX = 40 ;
1181+
11791182describeWithFlags ( 'randomGamma' , ALL_ENVS , ( ) => {
11801183 it ( 'should return a random 1D float32 array' , async ( ) => {
11811184 const shape : [ number ] = [ 10 ] ;
11821185
11831186 // Ensure defaults to float32 w/o type:
11841187 let result = tf . randomGamma ( shape , 2 , 2 ) ;
11851188 expect ( result . dtype ) . toBe ( 'float32' ) ;
1186- expectValuesInRange ( await result . data ( ) , 0 , 30 ) ;
1189+ expectValuesInRange ( await result . data ( ) , GAMMA_MIN , GAMMA_MAX ) ;
11871190
11881191 result = tf . randomGamma ( shape , 2 , 2 , 'float32' ) ;
11891192 expect ( result . dtype ) . toBe ( 'float32' ) ;
1190- expectValuesInRange ( await result . data ( ) , 0 , 30 ) ;
1193+ expectValuesInRange ( await result . data ( ) , GAMMA_MIN , GAMMA_MAX ) ;
11911194 } ) ;
11921195
11931196 it ( 'should return a random 1D int32 array' , async ( ) => {
11941197 const shape : [ number ] = [ 10 ] ;
11951198 const result = tf . randomGamma ( shape , 2 , 2 , 'int32' ) ;
11961199 expect ( result . dtype ) . toBe ( 'int32' ) ;
1197- expectValuesInRange ( await result . data ( ) , 0 , 30 ) ;
1200+ expectValuesInRange ( await result . data ( ) , GAMMA_MIN , GAMMA_MAX ) ;
11981201 } ) ;
11991202
12001203 it ( 'should return a random 2D float32 array' , async ( ) => {
@@ -1203,18 +1206,18 @@ describeWithFlags('randomGamma', ALL_ENVS, () => {
12031206 // Ensure defaults to float32 w/o type:
12041207 let result = tf . randomGamma ( shape , 2 , 2 ) ;
12051208 expect ( result . dtype ) . toBe ( 'float32' ) ;
1206- expectValuesInRange ( await result . data ( ) , 0 , 30 ) ;
1209+ expectValuesInRange ( await result . data ( ) , GAMMA_MIN , GAMMA_MAX ) ;
12071210
12081211 result = tf . randomGamma ( shape , 2 , 2 , 'float32' ) ;
12091212 expect ( result . dtype ) . toBe ( 'float32' ) ;
1210- expectValuesInRange ( await result . data ( ) , 0 , 30 ) ;
1213+ expectValuesInRange ( await result . data ( ) , GAMMA_MIN , GAMMA_MAX ) ;
12111214 } ) ;
12121215
12131216 it ( 'should return a random 2D int32 array' , async ( ) => {
12141217 const shape : [ number , number ] = [ 3 , 4 ] ;
12151218 const result = tf . randomGamma ( shape , 2 , 2 , 'int32' ) ;
12161219 expect ( result . dtype ) . toBe ( 'int32' ) ;
1217- expectValuesInRange ( await result . data ( ) , 0 , 30 ) ;
1220+ expectValuesInRange ( await result . data ( ) , GAMMA_MIN , GAMMA_MAX ) ;
12181221 } ) ;
12191222
12201223 it ( 'should return a random 3D float32 array' , async ( ) => {
@@ -1223,18 +1226,18 @@ describeWithFlags('randomGamma', ALL_ENVS, () => {
12231226 // Ensure defaults to float32 w/o type:
12241227 let result = tf . randomGamma ( shape , 2 , 2 ) ;
12251228 expect ( result . dtype ) . toBe ( 'float32' ) ;
1226- expectValuesInRange ( await result . data ( ) , 0 , 30 ) ;
1229+ expectValuesInRange ( await result . data ( ) , GAMMA_MIN , GAMMA_MAX ) ;
12271230
12281231 result = tf . randomGamma ( shape , 2 , 2 , 'float32' ) ;
12291232 expect ( result . dtype ) . toBe ( 'float32' ) ;
1230- expectValuesInRange ( await result . data ( ) , 0 , 30 ) ;
1233+ expectValuesInRange ( await result . data ( ) , GAMMA_MIN , GAMMA_MAX ) ;
12311234 } ) ;
12321235
12331236 it ( 'should return a random 3D int32 array' , async ( ) => {
12341237 const shape : [ number , number , number ] = [ 3 , 4 , 5 ] ;
12351238 const result = tf . randomGamma ( shape , 2 , 2 , 'int32' ) ;
12361239 expect ( result . dtype ) . toBe ( 'int32' ) ;
1237- expectValuesInRange ( await result . data ( ) , 0 , 30 ) ;
1240+ expectValuesInRange ( await result . data ( ) , GAMMA_MIN , GAMMA_MAX ) ;
12381241 } ) ;
12391242
12401243 it ( 'should return a random 4D float32 array' , async ( ) => {
@@ -1243,18 +1246,18 @@ describeWithFlags('randomGamma', ALL_ENVS, () => {
12431246 // Ensure defaults to float32 w/o type:
12441247 let result = tf . randomGamma ( shape , 2 , 2 ) ;
12451248 expect ( result . dtype ) . toBe ( 'float32' ) ;
1246- expectValuesInRange ( await result . data ( ) , 0 , 30 ) ;
1249+ expectValuesInRange ( await result . data ( ) , GAMMA_MIN , GAMMA_MAX ) ;
12471250
12481251 result = tf . randomGamma ( shape , 2 , 2 , 'float32' ) ;
12491252 expect ( result . dtype ) . toBe ( 'float32' ) ;
1250- expectValuesInRange ( await result . data ( ) , 0 , 30 ) ;
1253+ expectValuesInRange ( await result . data ( ) , GAMMA_MIN , GAMMA_MAX ) ;
12511254 } ) ;
12521255
12531256 it ( 'should return a random 4D int32 array' , async ( ) => {
12541257 const shape : [ number , number , number , number ] = [ 3 , 4 , 5 , 6 ] ;
12551258 const result = tf . randomGamma ( shape , 2 , 2 , 'int32' ) ;
12561259 expect ( result . dtype ) . toBe ( 'int32' ) ;
1257- expectValuesInRange ( await result . data ( ) , 0 , 30 ) ;
1260+ expectValuesInRange ( await result . data ( ) , GAMMA_MIN , GAMMA_MAX ) ;
12581261 } ) ;
12591262
12601263 it ( 'should return a random 5D float32 array' , async ( ) => {
@@ -1263,18 +1266,18 @@ describeWithFlags('randomGamma', ALL_ENVS, () => {
12631266 // Ensure defaults to float32 w/o type:
12641267 let result = tf . randomGamma ( shape , 2 , 2 ) ;
12651268 expect ( result . dtype ) . toBe ( 'float32' ) ;
1266- expectValuesInRange ( await result . data ( ) , 0 , 30 ) ;
1269+ expectValuesInRange ( await result . data ( ) , GAMMA_MIN , GAMMA_MAX ) ;
12671270
12681271 result = tf . randomGamma ( shape , 2 , 2 , 'float32' ) ;
12691272 expect ( result . dtype ) . toBe ( 'float32' ) ;
1270- expectValuesInRange ( await result . data ( ) , 0 , 30 ) ;
1273+ expectValuesInRange ( await result . data ( ) , GAMMA_MIN , GAMMA_MAX ) ;
12711274 } ) ;
12721275
12731276 it ( 'should return a random 5D int32 array' , async ( ) => {
12741277 const shape : [ number , number , number , number , number ] = [ 2 , 3 , 4 , 5 , 6 ] ;
12751278 const result = tf . randomGamma ( shape , 2 , 2 , 'int32' ) ;
12761279 expect ( result . dtype ) . toBe ( 'int32' ) ;
1277- expectValuesInRange ( await result . data ( ) , 0 , 30 ) ;
1280+ expectValuesInRange ( await result . data ( ) , GAMMA_MIN , GAMMA_MAX ) ;
12781281 } ) ;
12791282} ) ;
12801283
0 commit comments