Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/tensorflow/python/ops/gen_stateless_random_ops.py: 11%

401 statements  

« prev     ^ index     » next       coverage.py v7.4.0, created at 2024-01-03 07:57 +0000

1"""Python wrappers around TensorFlow ops. 

2 

3This file is MACHINE GENERATED! Do not edit. 

4""" 

5 

6import collections 

7 

8from tensorflow.python import pywrap_tfe as pywrap_tfe 

9from tensorflow.python.eager import context as _context 

10from tensorflow.python.eager import core as _core 

11from tensorflow.python.eager import execute as _execute 

12from tensorflow.python.framework import dtypes as _dtypes 

13from tensorflow.security.fuzzing.py import annotation_types as _atypes 

14 

15from tensorflow.python.framework import op_def_registry as _op_def_registry 

16from tensorflow.python.framework import ops as _ops 

17from tensorflow.python.framework import op_def_library as _op_def_library 

18from tensorflow.python.util.deprecation import deprecated_endpoints 

19from tensorflow.python.util import dispatch as _dispatch 

20from tensorflow.python.util.tf_export import tf_export 

21 

22from typing import TypeVar 

23 

24def stateless_multinomial(logits, num_samples, seed, output_dtype=_dtypes.int64, name=None): 

25 r"""Draws samples from a multinomial distribution. 

26 

27 Args: 

28 logits: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `uint8`, `int16`, `int8`, `int64`, `bfloat16`, `uint16`, `half`, `uint32`, `uint64`. 

29 2-D Tensor with shape `[batch_size, num_classes]`. Each slice `[i, :]` 

30 represents the unnormalized log probabilities for all classes. 

31 num_samples: A `Tensor` of type `int32`. 

32 0-D. Number of independent samples to draw for each row slice. 

33 seed: A `Tensor`. Must be one of the following types: `int32`, `int64`. 

34 2 seeds (shape [2]). 

35 output_dtype: An optional `tf.DType` from: `tf.int32, tf.int64`. Defaults to `tf.int64`. 

36 name: A name for the operation (optional). 

37 

38 Returns: 

39 A `Tensor` of type `output_dtype`. 

40 """ 

41 _ctx = _context._context or _context.context() 

42 tld = _ctx._thread_local_data 

43 if tld.is_eager: 

44 try: 

45 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

46 _ctx, "StatelessMultinomial", name, logits, num_samples, seed, 

47 "output_dtype", output_dtype) 

48 return _result 

49 except _core._NotOkStatusException as e: 

50 _ops.raise_from_not_ok_status(e, name) 

51 except _core._FallbackException: 

52 pass 

53 try: 

54 return stateless_multinomial_eager_fallback( 

55 logits, num_samples, seed, output_dtype=output_dtype, name=name, 

56 ctx=_ctx) 

57 except _core._SymbolicException: 

58 pass # Add nodes to the TensorFlow graph. 

59 # Add nodes to the TensorFlow graph. 

60 if output_dtype is None: 

61 output_dtype = _dtypes.int64 

62 output_dtype = _execute.make_type(output_dtype, "output_dtype") 

63 _, _, _op, _outputs = _op_def_library._apply_op_helper( 

64 "StatelessMultinomial", logits=logits, num_samples=num_samples, 

65 seed=seed, output_dtype=output_dtype, 

66 name=name) 

67 _result = _outputs[:] 

68 if _execute.must_record_gradient(): 

69 _attrs = ("T", _op._get_attr_type("T"), "Tseed", 

70 _op._get_attr_type("Tseed"), "output_dtype", 

71 _op._get_attr_type("output_dtype")) 

72 _inputs_flat = _op.inputs 

73 _execute.record_gradient( 

74 "StatelessMultinomial", _inputs_flat, _attrs, _result) 

75 _result, = _result 

76 return _result 

77 

78StatelessMultinomial = tf_export("raw_ops.StatelessMultinomial")(_ops.to_raw_op(stateless_multinomial)) 

79 

80 

81def stateless_multinomial_eager_fallback(logits, num_samples, seed, output_dtype, name, ctx): 

82 if output_dtype is None: 

83 output_dtype = _dtypes.int64 

84 output_dtype = _execute.make_type(output_dtype, "output_dtype") 

85 _attr_T, (logits,) = _execute.args_to_matching_eager([logits], ctx, [_dtypes.float32, _dtypes.float64, _dtypes.int32, _dtypes.uint8, _dtypes.int16, _dtypes.int8, _dtypes.int64, _dtypes.bfloat16, _dtypes.uint16, _dtypes.half, _dtypes.uint32, _dtypes.uint64, ]) 

86 _attr_Tseed, (seed,) = _execute.args_to_matching_eager([seed], ctx, [_dtypes.int32, _dtypes.int64, ], _dtypes.int64) 

87 num_samples = _ops.convert_to_tensor(num_samples, _dtypes.int32) 

88 _inputs_flat = [logits, num_samples, seed] 

89 _attrs = ("T", _attr_T, "Tseed", _attr_Tseed, "output_dtype", output_dtype) 

90 _result = _execute.execute(b"StatelessMultinomial", 1, inputs=_inputs_flat, 

91 attrs=_attrs, ctx=ctx, name=name) 

92 if _execute.must_record_gradient(): 

93 _execute.record_gradient( 

94 "StatelessMultinomial", _inputs_flat, _attrs, _result) 

95 _result, = _result 

96 return _result 

97 

98 

99def stateless_parameterized_truncated_normal(shape, seed, means, stddevs, minvals, maxvals, name=None): 

100 r"""TODO: add doc. 

101 

102 Args: 

103 shape: A `Tensor`. Must be one of the following types: `int32`, `int64`. 

104 The shape of the output tensor. 

105 seed: A `Tensor`. Must be one of the following types: `int32`, `int64`. 

106 2 seeds (shape [2]). 

107 means: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. 

108 The mean parameter of each batch. 

109 stddevs: A `Tensor`. Must have the same type as `means`. 

110 The standard deviation parameter of each batch. Must be greater than 0. 

111 minvals: A `Tensor`. Must have the same type as `means`. 

112 The minimum cutoff. May be -infinity. 

113 maxvals: A `Tensor`. Must have the same type as `means`. 

114 The maximum cutoff. May be +infinity, and must be more than the minval 

115 for each batch. 

116 name: A name for the operation (optional). 

117 

118 Returns: 

119 A `Tensor`. Has the same type as `means`. 

120 """ 

121 _ctx = _context._context or _context.context() 

122 tld = _ctx._thread_local_data 

123 if tld.is_eager: 

124 try: 

125 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

126 _ctx, "StatelessParameterizedTruncatedNormal", name, shape, seed, 

127 means, stddevs, minvals, maxvals) 

128 return _result 

129 except _core._NotOkStatusException as e: 

130 _ops.raise_from_not_ok_status(e, name) 

131 except _core._FallbackException: 

132 pass 

133 try: 

134 return stateless_parameterized_truncated_normal_eager_fallback( 

135 shape, seed, means, stddevs, minvals, maxvals, name=name, ctx=_ctx) 

136 except _core._SymbolicException: 

137 pass # Add nodes to the TensorFlow graph. 

138 # Add nodes to the TensorFlow graph. 

139 _, _, _op, _outputs = _op_def_library._apply_op_helper( 

140 "StatelessParameterizedTruncatedNormal", shape=shape, seed=seed, 

141 means=means, stddevs=stddevs, 

142 minvals=minvals, 

143 maxvals=maxvals, name=name) 

144 _result = _outputs[:] 

145 if _execute.must_record_gradient(): 

146 _attrs = ("S", _op._get_attr_type("S"), "Tseed", 

147 _op._get_attr_type("Tseed"), "dtype", 

148 _op._get_attr_type("dtype")) 

149 _inputs_flat = _op.inputs 

150 _execute.record_gradient( 

151 "StatelessParameterizedTruncatedNormal", _inputs_flat, _attrs, _result) 

152 _result, = _result 

153 return _result 

154 

155StatelessParameterizedTruncatedNormal = tf_export("raw_ops.StatelessParameterizedTruncatedNormal")(_ops.to_raw_op(stateless_parameterized_truncated_normal)) 

156 

157 

158def stateless_parameterized_truncated_normal_eager_fallback(shape, seed, means, stddevs, minvals, maxvals, name, ctx): 

159 _attr_S, (shape,) = _execute.args_to_matching_eager([shape], ctx, [_dtypes.int32, _dtypes.int64, ]) 

160 _attr_Tseed, (seed,) = _execute.args_to_matching_eager([seed], ctx, [_dtypes.int32, _dtypes.int64, ], _dtypes.int64) 

161 _attr_dtype, _inputs_dtype = _execute.args_to_matching_eager([means, stddevs, minvals, maxvals], ctx, [_dtypes.half, _dtypes.float32, _dtypes.float64, ]) 

162 (means, stddevs, minvals, maxvals) = _inputs_dtype 

163 _inputs_flat = [shape, seed, means, stddevs, minvals, maxvals] 

164 _attrs = ("S", _attr_S, "Tseed", _attr_Tseed, "dtype", _attr_dtype) 

165 _result = _execute.execute(b"StatelessParameterizedTruncatedNormal", 1, 

166 inputs=_inputs_flat, attrs=_attrs, ctx=ctx, 

167 name=name) 

168 if _execute.must_record_gradient(): 

169 _execute.record_gradient( 

170 "StatelessParameterizedTruncatedNormal", _inputs_flat, _attrs, _result) 

171 _result, = _result 

172 return _result 

173 

174 

175def stateless_random_binomial(shape, seed, counts, probs, dtype=_dtypes.int64, name=None): 

176 r"""Outputs deterministic pseudorandom random numbers from a binomial distribution. 

177 

178 Outputs random values from a binomial distribution. 

179 

180 The outputs are a deterministic function of `shape`, `seed`, `counts`, and `probs`. 

181 

182 Args: 

183 shape: A `Tensor`. Must be one of the following types: `int32`, `int64`. 

184 The shape of the output tensor. 

185 seed: A `Tensor`. Must be one of the following types: `int32`, `int64`. 

186 2 seeds (shape [2]). 

187 counts: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`. 

188 The counts of the binomial distribution. Must be broadcastable with `probs`, 

189 and broadcastable with the rightmost dimensions of `shape`. 

190 probs: A `Tensor`. Must have the same type as `counts`. 

191 The probability of success for the binomial distribution. Must be broadcastable 

192 with `counts` and broadcastable with the rightmost dimensions of `shape`. 

193 dtype: An optional `tf.DType` from: `tf.half, tf.float32, tf.float64, tf.int32, tf.int64`. Defaults to `tf.int64`. 

194 The type of the output. 

195 name: A name for the operation (optional). 

196 

197 Returns: 

198 A `Tensor` of type `dtype`. 

199 """ 

200 _ctx = _context._context or _context.context() 

201 tld = _ctx._thread_local_data 

202 if tld.is_eager: 

203 try: 

204 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

205 _ctx, "StatelessRandomBinomial", name, shape, seed, counts, probs, 

206 "dtype", dtype) 

207 return _result 

208 except _core._NotOkStatusException as e: 

209 _ops.raise_from_not_ok_status(e, name) 

210 except _core._FallbackException: 

211 pass 

212 try: 

213 return stateless_random_binomial_eager_fallback( 

214 shape, seed, counts, probs, dtype=dtype, name=name, ctx=_ctx) 

215 except _core._SymbolicException: 

216 pass # Add nodes to the TensorFlow graph. 

217 # Add nodes to the TensorFlow graph. 

218 if dtype is None: 

219 dtype = _dtypes.int64 

220 dtype = _execute.make_type(dtype, "dtype") 

221 _, _, _op, _outputs = _op_def_library._apply_op_helper( 

222 "StatelessRandomBinomial", shape=shape, seed=seed, counts=counts, 

223 probs=probs, dtype=dtype, name=name) 

224 _result = _outputs[:] 

225 if _execute.must_record_gradient(): 

226 _attrs = ("S", _op._get_attr_type("S"), "Tseed", 

227 _op._get_attr_type("Tseed"), "T", _op._get_attr_type("T"), 

228 "dtype", _op._get_attr_type("dtype")) 

229 _inputs_flat = _op.inputs 

230 _execute.record_gradient( 

231 "StatelessRandomBinomial", _inputs_flat, _attrs, _result) 

232 _result, = _result 

233 return _result 

234 

235StatelessRandomBinomial = tf_export("raw_ops.StatelessRandomBinomial")(_ops.to_raw_op(stateless_random_binomial)) 

236 

237 

238def stateless_random_binomial_eager_fallback(shape, seed, counts, probs, dtype, name, ctx): 

239 if dtype is None: 

240 dtype = _dtypes.int64 

241 dtype = _execute.make_type(dtype, "dtype") 

242 _attr_S, (shape,) = _execute.args_to_matching_eager([shape], ctx, [_dtypes.int32, _dtypes.int64, ]) 

243 _attr_Tseed, (seed,) = _execute.args_to_matching_eager([seed], ctx, [_dtypes.int32, _dtypes.int64, ], _dtypes.int64) 

244 _attr_T, _inputs_T = _execute.args_to_matching_eager([counts, probs], ctx, [_dtypes.half, _dtypes.float32, _dtypes.float64, _dtypes.int32, _dtypes.int64, ], _dtypes.float64) 

245 (counts, probs) = _inputs_T 

246 _inputs_flat = [shape, seed, counts, probs] 

247 _attrs = ("S", _attr_S, "Tseed", _attr_Tseed, "T", _attr_T, "dtype", dtype) 

248 _result = _execute.execute(b"StatelessRandomBinomial", 1, 

249 inputs=_inputs_flat, attrs=_attrs, ctx=ctx, 

250 name=name) 

251 if _execute.must_record_gradient(): 

252 _execute.record_gradient( 

253 "StatelessRandomBinomial", _inputs_flat, _attrs, _result) 

254 _result, = _result 

255 return _result 

256 

257 

258def stateless_random_gamma_v2(shape, seed, alpha, name=None): 

259 r"""Outputs deterministic pseudorandom random numbers from a gamma distribution. 

260 

261 Outputs random values from a gamma distribution. 

262 

263 The outputs are a deterministic function of `shape`, `seed`, and `alpha`. 

264 

265 Args: 

266 shape: A `Tensor`. Must be one of the following types: `int32`, `int64`. 

267 The shape of the output tensor. 

268 seed: A `Tensor`. Must be one of the following types: `int32`, `int64`. 

269 2 seeds (shape [2]). 

270 alpha: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. 

271 The concentration of the gamma distribution. Shape must match the rightmost 

272 dimensions of `shape`. 

273 name: A name for the operation (optional). 

274 

275 Returns: 

276 A `Tensor`. Has the same type as `alpha`. 

277 """ 

278 _ctx = _context._context or _context.context() 

279 tld = _ctx._thread_local_data 

280 if tld.is_eager: 

281 try: 

282 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

283 _ctx, "StatelessRandomGammaV2", name, shape, seed, alpha) 

284 return _result 

285 except _core._NotOkStatusException as e: 

286 _ops.raise_from_not_ok_status(e, name) 

287 except _core._FallbackException: 

288 pass 

289 try: 

290 return stateless_random_gamma_v2_eager_fallback( 

291 shape, seed, alpha, name=name, ctx=_ctx) 

292 except _core._SymbolicException: 

293 pass # Add nodes to the TensorFlow graph. 

294 # Add nodes to the TensorFlow graph. 

295 _, _, _op, _outputs = _op_def_library._apply_op_helper( 

296 "StatelessRandomGammaV2", shape=shape, seed=seed, alpha=alpha, 

297 name=name) 

298 _result = _outputs[:] 

299 if _execute.must_record_gradient(): 

300 _attrs = ("dtype", _op._get_attr_type("dtype"), "T", 

301 _op._get_attr_type("T"), "Tseed", _op._get_attr_type("Tseed")) 

302 _inputs_flat = _op.inputs 

303 _execute.record_gradient( 

304 "StatelessRandomGammaV2", _inputs_flat, _attrs, _result) 

305 _result, = _result 

306 return _result 

307 

308StatelessRandomGammaV2 = tf_export("raw_ops.StatelessRandomGammaV2")(_ops.to_raw_op(stateless_random_gamma_v2)) 

309 

310 

311def stateless_random_gamma_v2_eager_fallback(shape, seed, alpha, name, ctx): 

312 _attr_dtype, (alpha,) = _execute.args_to_matching_eager([alpha], ctx, [_dtypes.half, _dtypes.float32, _dtypes.float64, ]) 

313 _attr_T, (shape,) = _execute.args_to_matching_eager([shape], ctx, [_dtypes.int32, _dtypes.int64, ]) 

314 _attr_Tseed, (seed,) = _execute.args_to_matching_eager([seed], ctx, [_dtypes.int32, _dtypes.int64, ], _dtypes.int64) 

315 _inputs_flat = [shape, seed, alpha] 

316 _attrs = ("dtype", _attr_dtype, "T", _attr_T, "Tseed", _attr_Tseed) 

317 _result = _execute.execute(b"StatelessRandomGammaV2", 1, 

318 inputs=_inputs_flat, attrs=_attrs, ctx=ctx, 

319 name=name) 

320 if _execute.must_record_gradient(): 

321 _execute.record_gradient( 

322 "StatelessRandomGammaV2", _inputs_flat, _attrs, _result) 

323 _result, = _result 

324 return _result 

325 

326 

327def stateless_random_normal(shape, seed, dtype=_dtypes.float32, name=None): 

328 r"""Outputs deterministic pseudorandom values from a normal distribution. 

329 

330 The generated values will have mean 0 and standard deviation 1. 

331 

332 The outputs are a deterministic function of `shape` and `seed`. 

333 

334 Args: 

335 shape: A `Tensor`. Must be one of the following types: `int32`, `int64`. 

336 The shape of the output tensor. 

337 seed: A `Tensor`. Must be one of the following types: `int32`, `int64`. 

338 2 seeds (shape [2]). 

339 dtype: An optional `tf.DType` from: `tf.half, tf.bfloat16, tf.float32, tf.float64`. Defaults to `tf.float32`. 

340 The type of the output. 

341 name: A name for the operation (optional). 

342 

343 Returns: 

344 A `Tensor` of type `dtype`. 

345 """ 

346 _ctx = _context._context or _context.context() 

347 tld = _ctx._thread_local_data 

348 if tld.is_eager: 

349 try: 

350 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

351 _ctx, "StatelessRandomNormal", name, shape, seed, "dtype", dtype) 

352 return _result 

353 except _core._NotOkStatusException as e: 

354 _ops.raise_from_not_ok_status(e, name) 

355 except _core._FallbackException: 

356 pass 

357 try: 

358 return stateless_random_normal_eager_fallback( 

359 shape, seed, dtype=dtype, name=name, ctx=_ctx) 

360 except _core._SymbolicException: 

361 pass # Add nodes to the TensorFlow graph. 

362 # Add nodes to the TensorFlow graph. 

363 if dtype is None: 

364 dtype = _dtypes.float32 

365 dtype = _execute.make_type(dtype, "dtype") 

366 _, _, _op, _outputs = _op_def_library._apply_op_helper( 

367 "StatelessRandomNormal", shape=shape, seed=seed, dtype=dtype, 

368 name=name) 

369 _result = _outputs[:] 

370 if _execute.must_record_gradient(): 

371 _attrs = ("dtype", _op._get_attr_type("dtype"), "T", 

372 _op._get_attr_type("T"), "Tseed", _op._get_attr_type("Tseed")) 

373 _inputs_flat = _op.inputs 

374 _execute.record_gradient( 

375 "StatelessRandomNormal", _inputs_flat, _attrs, _result) 

376 _result, = _result 

377 return _result 

378 

379StatelessRandomNormal = tf_export("raw_ops.StatelessRandomNormal")(_ops.to_raw_op(stateless_random_normal)) 

380 

381 

382def stateless_random_normal_eager_fallback(shape, seed, dtype, name, ctx): 

383 if dtype is None: 

384 dtype = _dtypes.float32 

385 dtype = _execute.make_type(dtype, "dtype") 

386 _attr_T, (shape,) = _execute.args_to_matching_eager([shape], ctx, [_dtypes.int32, _dtypes.int64, ], _dtypes.int32) 

387 _attr_Tseed, (seed,) = _execute.args_to_matching_eager([seed], ctx, [_dtypes.int32, _dtypes.int64, ], _dtypes.int64) 

388 _inputs_flat = [shape, seed] 

389 _attrs = ("dtype", dtype, "T", _attr_T, "Tseed", _attr_Tseed) 

390 _result = _execute.execute(b"StatelessRandomNormal", 1, inputs=_inputs_flat, 

391 attrs=_attrs, ctx=ctx, name=name) 

392 if _execute.must_record_gradient(): 

393 _execute.record_gradient( 

394 "StatelessRandomNormal", _inputs_flat, _attrs, _result) 

395 _result, = _result 

396 return _result 

397 

398 

399def stateless_random_poisson(shape, seed, lam, dtype, name=None): 

400 r"""Outputs deterministic pseudorandom random numbers from a Poisson distribution. 

401 

402 Outputs random values from a Poisson distribution. 

403 

404 The outputs are a deterministic function of `shape`, `seed`, and `lam`. 

405 

406 Args: 

407 shape: A `Tensor`. Must be one of the following types: `int32`, `int64`. 

408 The shape of the output tensor. 

409 seed: A `Tensor`. Must be one of the following types: `int32`, `int64`. 

410 2 seeds (shape [2]). 

411 lam: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`. 

412 The rate of the Poisson distribution. Shape must match the rightmost dimensions 

413 of `shape`. 

414 dtype: A `tf.DType` from: `tf.half, tf.float32, tf.float64, tf.int32, tf.int64`. 

415 The type of the output. 

416 name: A name for the operation (optional). 

417 

418 Returns: 

419 A `Tensor` of type `dtype`. 

420 """ 

421 _ctx = _context._context or _context.context() 

422 tld = _ctx._thread_local_data 

423 if tld.is_eager: 

424 try: 

425 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

426 _ctx, "StatelessRandomPoisson", name, shape, seed, lam, "dtype", 

427 dtype) 

428 return _result 

429 except _core._NotOkStatusException as e: 

430 _ops.raise_from_not_ok_status(e, name) 

431 except _core._FallbackException: 

432 pass 

433 try: 

434 return stateless_random_poisson_eager_fallback( 

435 shape, seed, lam, dtype=dtype, name=name, ctx=_ctx) 

436 except _core._SymbolicException: 

437 pass # Add nodes to the TensorFlow graph. 

438 # Add nodes to the TensorFlow graph. 

439 dtype = _execute.make_type(dtype, "dtype") 

440 _, _, _op, _outputs = _op_def_library._apply_op_helper( 

441 "StatelessRandomPoisson", shape=shape, seed=seed, lam=lam, 

442 dtype=dtype, name=name) 

443 _result = _outputs[:] 

444 if _execute.must_record_gradient(): 

445 _attrs = ("Rtype", _op._get_attr_type("Rtype"), "dtype", 

446 _op._get_attr_type("dtype"), "T", _op._get_attr_type("T"), 

447 "Tseed", _op._get_attr_type("Tseed")) 

448 _inputs_flat = _op.inputs 

449 _execute.record_gradient( 

450 "StatelessRandomPoisson", _inputs_flat, _attrs, _result) 

451 _result, = _result 

452 return _result 

453 

454StatelessRandomPoisson = tf_export("raw_ops.StatelessRandomPoisson")(_ops.to_raw_op(stateless_random_poisson)) 

455 

456 

457def stateless_random_poisson_eager_fallback(shape, seed, lam, dtype, name, ctx): 

458 dtype = _execute.make_type(dtype, "dtype") 

459 _attr_Rtype, (lam,) = _execute.args_to_matching_eager([lam], ctx, [_dtypes.half, _dtypes.float32, _dtypes.float64, _dtypes.int32, _dtypes.int64, ]) 

460 _attr_T, (shape,) = _execute.args_to_matching_eager([shape], ctx, [_dtypes.int32, _dtypes.int64, ]) 

461 _attr_Tseed, (seed,) = _execute.args_to_matching_eager([seed], ctx, [_dtypes.int32, _dtypes.int64, ], _dtypes.int64) 

462 _inputs_flat = [shape, seed, lam] 

463 _attrs = ("Rtype", _attr_Rtype, "dtype", dtype, "T", _attr_T, "Tseed", 

464 _attr_Tseed) 

465 _result = _execute.execute(b"StatelessRandomPoisson", 1, 

466 inputs=_inputs_flat, attrs=_attrs, ctx=ctx, 

467 name=name) 

468 if _execute.must_record_gradient(): 

469 _execute.record_gradient( 

470 "StatelessRandomPoisson", _inputs_flat, _attrs, _result) 

471 _result, = _result 

472 return _result 

473 

474 

475def stateless_random_uniform(shape, seed, dtype=_dtypes.float32, name=None): 

476 r"""Outputs deterministic pseudorandom random values from a uniform distribution. 

477 

478 The generated values follow a uniform distribution in the range `[0, 1)`. The 

479 lower bound 0 is included in the range, while the upper bound 1 is excluded. 

480 

481 The outputs are a deterministic function of `shape` and `seed`. 

482 

483 Args: 

484 shape: A `Tensor`. Must be one of the following types: `int32`, `int64`. 

485 The shape of the output tensor. 

486 seed: A `Tensor`. Must be one of the following types: `int32`, `int64`. 

487 2 seeds (shape [2]). 

488 dtype: An optional `tf.DType` from: `tf.half, tf.bfloat16, tf.float32, tf.float64`. Defaults to `tf.float32`. 

489 The type of the output. 

490 name: A name for the operation (optional). 

491 

492 Returns: 

493 A `Tensor` of type `dtype`. 

494 """ 

495 _ctx = _context._context or _context.context() 

496 tld = _ctx._thread_local_data 

497 if tld.is_eager: 

498 try: 

499 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

500 _ctx, "StatelessRandomUniform", name, shape, seed, "dtype", dtype) 

501 return _result 

502 except _core._NotOkStatusException as e: 

503 _ops.raise_from_not_ok_status(e, name) 

504 except _core._FallbackException: 

505 pass 

506 try: 

507 return stateless_random_uniform_eager_fallback( 

508 shape, seed, dtype=dtype, name=name, ctx=_ctx) 

509 except _core._SymbolicException: 

510 pass # Add nodes to the TensorFlow graph. 

511 # Add nodes to the TensorFlow graph. 

512 if dtype is None: 

513 dtype = _dtypes.float32 

514 dtype = _execute.make_type(dtype, "dtype") 

515 _, _, _op, _outputs = _op_def_library._apply_op_helper( 

516 "StatelessRandomUniform", shape=shape, seed=seed, dtype=dtype, 

517 name=name) 

518 _result = _outputs[:] 

519 if _execute.must_record_gradient(): 

520 _attrs = ("dtype", _op._get_attr_type("dtype"), "T", 

521 _op._get_attr_type("T"), "Tseed", _op._get_attr_type("Tseed")) 

522 _inputs_flat = _op.inputs 

523 _execute.record_gradient( 

524 "StatelessRandomUniform", _inputs_flat, _attrs, _result) 

525 _result, = _result 

526 return _result 

527 

528StatelessRandomUniform = tf_export("raw_ops.StatelessRandomUniform")(_ops.to_raw_op(stateless_random_uniform)) 

529 

530 

531def stateless_random_uniform_eager_fallback(shape, seed, dtype, name, ctx): 

532 if dtype is None: 

533 dtype = _dtypes.float32 

534 dtype = _execute.make_type(dtype, "dtype") 

535 _attr_T, (shape,) = _execute.args_to_matching_eager([shape], ctx, [_dtypes.int32, _dtypes.int64, ], _dtypes.int32) 

536 _attr_Tseed, (seed,) = _execute.args_to_matching_eager([seed], ctx, [_dtypes.int32, _dtypes.int64, ], _dtypes.int64) 

537 _inputs_flat = [shape, seed] 

538 _attrs = ("dtype", dtype, "T", _attr_T, "Tseed", _attr_Tseed) 

539 _result = _execute.execute(b"StatelessRandomUniform", 1, 

540 inputs=_inputs_flat, attrs=_attrs, ctx=ctx, 

541 name=name) 

542 if _execute.must_record_gradient(): 

543 _execute.record_gradient( 

544 "StatelessRandomUniform", _inputs_flat, _attrs, _result) 

545 _result, = _result 

546 return _result 

547 

548 

549def stateless_random_uniform_full_int(shape, seed, dtype=_dtypes.uint64, name=None): 

550 r"""Outputs deterministic pseudorandom random integers from a uniform distribution. 

551 

552 The generated values are uniform integers covering the whole range of `dtype`. 

553 

554 The outputs are a deterministic function of `shape` and `seed`. 

555 

556 Args: 

557 shape: A `Tensor`. Must be one of the following types: `int32`, `int64`. 

558 The shape of the output tensor. 

559 seed: A `Tensor`. Must be one of the following types: `int32`, `int64`, `uint32`, `uint64`. 

560 2 seeds (shape [2]). 

561 dtype: An optional `tf.DType` from: `tf.int32, tf.int64, tf.uint32, tf.uint64`. Defaults to `tf.uint64`. 

562 The type of the output. 

563 name: A name for the operation (optional). 

564 

565 Returns: 

566 A `Tensor` of type `dtype`. 

567 """ 

568 _ctx = _context._context or _context.context() 

569 tld = _ctx._thread_local_data 

570 if tld.is_eager: 

571 try: 

572 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

573 _ctx, "StatelessRandomUniformFullInt", name, shape, seed, "dtype", 

574 dtype) 

575 return _result 

576 except _core._NotOkStatusException as e: 

577 _ops.raise_from_not_ok_status(e, name) 

578 except _core._FallbackException: 

579 pass 

580 try: 

581 return stateless_random_uniform_full_int_eager_fallback( 

582 shape, seed, dtype=dtype, name=name, ctx=_ctx) 

583 except _core._SymbolicException: 

584 pass # Add nodes to the TensorFlow graph. 

585 # Add nodes to the TensorFlow graph. 

586 if dtype is None: 

587 dtype = _dtypes.uint64 

588 dtype = _execute.make_type(dtype, "dtype") 

589 _, _, _op, _outputs = _op_def_library._apply_op_helper( 

590 "StatelessRandomUniformFullInt", shape=shape, seed=seed, dtype=dtype, 

591 name=name) 

592 _result = _outputs[:] 

593 if _execute.must_record_gradient(): 

594 _attrs = ("dtype", _op._get_attr_type("dtype"), "T", 

595 _op._get_attr_type("T"), "Tseed", _op._get_attr_type("Tseed")) 

596 _inputs_flat = _op.inputs 

597 _execute.record_gradient( 

598 "StatelessRandomUniformFullInt", _inputs_flat, _attrs, _result) 

599 _result, = _result 

600 return _result 

601 

602StatelessRandomUniformFullInt = tf_export("raw_ops.StatelessRandomUniformFullInt")(_ops.to_raw_op(stateless_random_uniform_full_int)) 

603 

604 

605def stateless_random_uniform_full_int_eager_fallback(shape, seed, dtype, name, ctx): 

606 if dtype is None: 

607 dtype = _dtypes.uint64 

608 dtype = _execute.make_type(dtype, "dtype") 

609 _attr_T, (shape,) = _execute.args_to_matching_eager([shape], ctx, [_dtypes.int32, _dtypes.int64, ], _dtypes.int32) 

610 _attr_Tseed, (seed,) = _execute.args_to_matching_eager([seed], ctx, [_dtypes.int32, _dtypes.int64, _dtypes.uint32, _dtypes.uint64, ], _dtypes.int64) 

611 _inputs_flat = [shape, seed] 

612 _attrs = ("dtype", dtype, "T", _attr_T, "Tseed", _attr_Tseed) 

613 _result = _execute.execute(b"StatelessRandomUniformFullInt", 1, 

614 inputs=_inputs_flat, attrs=_attrs, ctx=ctx, 

615 name=name) 

616 if _execute.must_record_gradient(): 

617 _execute.record_gradient( 

618 "StatelessRandomUniformFullInt", _inputs_flat, _attrs, _result) 

619 _result, = _result 

620 return _result 

621 

622 

623def stateless_random_uniform_int(shape, seed, minval, maxval, name=None): 

624 r"""Outputs deterministic pseudorandom random integers from a uniform distribution. 

625 

626 The generated values follow a uniform distribution in the range `[minval, maxval)`. 

627 

628 The outputs are a deterministic function of `shape`, `seed`, `minval`, and `maxval`. 

629 

630 Args: 

631 shape: A `Tensor`. Must be one of the following types: `int32`, `int64`. 

632 The shape of the output tensor. 

633 seed: A `Tensor`. Must be one of the following types: `int32`, `int64`. 

634 2 seeds (shape [2]). 

635 minval: A `Tensor`. Must be one of the following types: `int32`, `int64`. 

636 Minimum value (inclusive, scalar). 

637 maxval: A `Tensor`. Must have the same type as `minval`. 

638 Maximum value (exclusive, scalar). 

639 name: A name for the operation (optional). 

640 

641 Returns: 

642 A `Tensor`. Has the same type as `minval`. 

643 """ 

644 _ctx = _context._context or _context.context() 

645 tld = _ctx._thread_local_data 

646 if tld.is_eager: 

647 try: 

648 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

649 _ctx, "StatelessRandomUniformInt", name, shape, seed, minval, maxval) 

650 return _result 

651 except _core._NotOkStatusException as e: 

652 _ops.raise_from_not_ok_status(e, name) 

653 except _core._FallbackException: 

654 pass 

655 try: 

656 return stateless_random_uniform_int_eager_fallback( 

657 shape, seed, minval, maxval, name=name, ctx=_ctx) 

658 except _core._SymbolicException: 

659 pass # Add nodes to the TensorFlow graph. 

660 # Add nodes to the TensorFlow graph. 

661 _, _, _op, _outputs = _op_def_library._apply_op_helper( 

662 "StatelessRandomUniformInt", shape=shape, seed=seed, minval=minval, 

663 maxval=maxval, name=name) 

664 _result = _outputs[:] 

665 if _execute.must_record_gradient(): 

666 _attrs = ("dtype", _op._get_attr_type("dtype"), "T", 

667 _op._get_attr_type("T"), "Tseed", _op._get_attr_type("Tseed")) 

668 _inputs_flat = _op.inputs 

669 _execute.record_gradient( 

670 "StatelessRandomUniformInt", _inputs_flat, _attrs, _result) 

671 _result, = _result 

672 return _result 

673 

674StatelessRandomUniformInt = tf_export("raw_ops.StatelessRandomUniformInt")(_ops.to_raw_op(stateless_random_uniform_int)) 

675 

676 

677def stateless_random_uniform_int_eager_fallback(shape, seed, minval, maxval, name, ctx): 

678 _attr_dtype, _inputs_dtype = _execute.args_to_matching_eager([minval, maxval], ctx, [_dtypes.int32, _dtypes.int64, ]) 

679 (minval, maxval) = _inputs_dtype 

680 _attr_T, (shape,) = _execute.args_to_matching_eager([shape], ctx, [_dtypes.int32, _dtypes.int64, ]) 

681 _attr_Tseed, (seed,) = _execute.args_to_matching_eager([seed], ctx, [_dtypes.int32, _dtypes.int64, ], _dtypes.int64) 

682 _inputs_flat = [shape, seed, minval, maxval] 

683 _attrs = ("dtype", _attr_dtype, "T", _attr_T, "Tseed", _attr_Tseed) 

684 _result = _execute.execute(b"StatelessRandomUniformInt", 1, 

685 inputs=_inputs_flat, attrs=_attrs, ctx=ctx, 

686 name=name) 

687 if _execute.must_record_gradient(): 

688 _execute.record_gradient( 

689 "StatelessRandomUniformInt", _inputs_flat, _attrs, _result) 

690 _result, = _result 

691 return _result 

692 

693 

694def stateless_truncated_normal(shape, seed, dtype=_dtypes.float32, name=None): 

695 r"""Outputs deterministic pseudorandom values from a truncated normal distribution. 

696 

697 The generated values follow a normal distribution with mean 0 and standard 

698 deviation 1, except that values whose magnitude is more than 2 standard 

699 deviations from the mean are dropped and re-picked. 

700 

701 The outputs are a deterministic function of `shape` and `seed`. 

702 

703 Args: 

704 shape: A `Tensor`. Must be one of the following types: `int32`, `int64`. 

705 The shape of the output tensor. 

706 seed: A `Tensor`. Must be one of the following types: `int32`, `int64`. 

707 2 seeds (shape [2]). 

708 dtype: An optional `tf.DType` from: `tf.half, tf.bfloat16, tf.float32, tf.float64`. Defaults to `tf.float32`. 

709 The type of the output. 

710 name: A name for the operation (optional). 

711 

712 Returns: 

713 A `Tensor` of type `dtype`. 

714 """ 

715 _ctx = _context._context or _context.context() 

716 tld = _ctx._thread_local_data 

717 if tld.is_eager: 

718 try: 

719 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

720 _ctx, "StatelessTruncatedNormal", name, shape, seed, "dtype", dtype) 

721 return _result 

722 except _core._NotOkStatusException as e: 

723 _ops.raise_from_not_ok_status(e, name) 

724 except _core._FallbackException: 

725 pass 

726 try: 

727 return stateless_truncated_normal_eager_fallback( 

728 shape, seed, dtype=dtype, name=name, ctx=_ctx) 

729 except _core._SymbolicException: 

730 pass # Add nodes to the TensorFlow graph. 

731 # Add nodes to the TensorFlow graph. 

732 if dtype is None: 

733 dtype = _dtypes.float32 

734 dtype = _execute.make_type(dtype, "dtype") 

735 _, _, _op, _outputs = _op_def_library._apply_op_helper( 

736 "StatelessTruncatedNormal", shape=shape, seed=seed, dtype=dtype, 

737 name=name) 

738 _result = _outputs[:] 

739 if _execute.must_record_gradient(): 

740 _attrs = ("dtype", _op._get_attr_type("dtype"), "T", 

741 _op._get_attr_type("T"), "Tseed", _op._get_attr_type("Tseed")) 

742 _inputs_flat = _op.inputs 

743 _execute.record_gradient( 

744 "StatelessTruncatedNormal", _inputs_flat, _attrs, _result) 

745 _result, = _result 

746 return _result 

747 

748StatelessTruncatedNormal = tf_export("raw_ops.StatelessTruncatedNormal")(_ops.to_raw_op(stateless_truncated_normal)) 

749 

750 

751def stateless_truncated_normal_eager_fallback(shape, seed, dtype, name, ctx): 

752 if dtype is None: 

753 dtype = _dtypes.float32 

754 dtype = _execute.make_type(dtype, "dtype") 

755 _attr_T, (shape,) = _execute.args_to_matching_eager([shape], ctx, [_dtypes.int32, _dtypes.int64, ], _dtypes.int32) 

756 _attr_Tseed, (seed,) = _execute.args_to_matching_eager([seed], ctx, [_dtypes.int32, _dtypes.int64, ], _dtypes.int64) 

757 _inputs_flat = [shape, seed] 

758 _attrs = ("dtype", dtype, "T", _attr_T, "Tseed", _attr_Tseed) 

759 _result = _execute.execute(b"StatelessTruncatedNormal", 1, 

760 inputs=_inputs_flat, attrs=_attrs, ctx=ctx, 

761 name=name) 

762 if _execute.must_record_gradient(): 

763 _execute.record_gradient( 

764 "StatelessTruncatedNormal", _inputs_flat, _attrs, _result) 

765 _result, = _result 

766 return _result 

767