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

522 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 copy(input, tensor_name="", debug_ops_spec=[], name=None): 

25 r"""Copy a tensor from CPU-to-CPU or GPU-to-GPU. 

26 

27 Performs CPU-to-CPU or GPU-to-GPU deep-copying of tensor, depending on the 

28 device on which the tensor is allocated. 

29 N.B.: If the all downstream attached debug ops are disabled given the current 

30 gRPC gating status, the output will simply forward the input tensor without 

31 deep-copying. See the documentation of Debug* ops for more details. 

32 

33 Unlike the CopyHost Op, this op does not have HostMemory constraint on its 

34 input or output. 

35 

36 Args: 

37 input: A `Tensor`. Input tensor. 

38 tensor_name: An optional `string`. Defaults to `""`. 

39 The name of the input tensor. 

40 debug_ops_spec: An optional list of `strings`. Defaults to `[]`. 

41 A list of debug op spec (op, url, gated_grpc) for attached debug 

42 ops. Each element of the list has the format 

43 <debug_op>;<grpc_url>;<gated_grpc>, wherein gated_grpc is boolean represented 

44 as 0/1. E.g., "DebugIdentity;grpc://foo:3333;1", 

45 "DebugIdentity;file:///tmp/tfdbg_1;0". 

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

47 

48 Returns: 

49 A `Tensor`. Has the same type as `input`. 

50 """ 

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

52 tld = _ctx._thread_local_data 

53 if tld.is_eager: 

54 try: 

55 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

56 _ctx, "Copy", name, input, "tensor_name", tensor_name, 

57 "debug_ops_spec", debug_ops_spec) 

58 return _result 

59 except _core._NotOkStatusException as e: 

60 _ops.raise_from_not_ok_status(e, name) 

61 except _core._FallbackException: 

62 pass 

63 try: 

64 return copy_eager_fallback( 

65 input, tensor_name=tensor_name, debug_ops_spec=debug_ops_spec, 

66 name=name, ctx=_ctx) 

67 except _core._SymbolicException: 

68 pass # Add nodes to the TensorFlow graph. 

69 # Add nodes to the TensorFlow graph. 

70 if tensor_name is None: 

71 tensor_name = "" 

72 tensor_name = _execute.make_str(tensor_name, "tensor_name") 

73 if debug_ops_spec is None: 

74 debug_ops_spec = [] 

75 if not isinstance(debug_ops_spec, (list, tuple)): 

76 raise TypeError( 

77 "Expected list for 'debug_ops_spec' argument to " 

78 "'copy' Op, not %r." % debug_ops_spec) 

79 debug_ops_spec = [_execute.make_str(_s, "debug_ops_spec") for _s in debug_ops_spec] 

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

81 "Copy", input=input, tensor_name=tensor_name, 

82 debug_ops_spec=debug_ops_spec, name=name) 

83 _result = _outputs[:] 

84 if _execute.must_record_gradient(): 

85 _attrs = ("T", _op._get_attr_type("T"), "tensor_name", 

86 _op.get_attr("tensor_name"), "debug_ops_spec", 

87 _op.get_attr("debug_ops_spec")) 

88 _inputs_flat = _op.inputs 

89 _execute.record_gradient( 

90 "Copy", _inputs_flat, _attrs, _result) 

91 _result, = _result 

92 return _result 

93 

94Copy = tf_export("raw_ops.Copy")(_ops.to_raw_op(copy)) 

95 

96 

97def copy_eager_fallback(input, tensor_name, debug_ops_spec, name, ctx): 

98 if tensor_name is None: 

99 tensor_name = "" 

100 tensor_name = _execute.make_str(tensor_name, "tensor_name") 

101 if debug_ops_spec is None: 

102 debug_ops_spec = [] 

103 if not isinstance(debug_ops_spec, (list, tuple)): 

104 raise TypeError( 

105 "Expected list for 'debug_ops_spec' argument to " 

106 "'copy' Op, not %r." % debug_ops_spec) 

107 debug_ops_spec = [_execute.make_str(_s, "debug_ops_spec") for _s in debug_ops_spec] 

108 _attr_T, (input,) = _execute.args_to_matching_eager([input], ctx, []) 

109 _inputs_flat = [input] 

110 _attrs = ("T", _attr_T, "tensor_name", tensor_name, "debug_ops_spec", 

111 debug_ops_spec) 

112 _result = _execute.execute(b"Copy", 1, inputs=_inputs_flat, attrs=_attrs, 

113 ctx=ctx, name=name) 

114 if _execute.must_record_gradient(): 

115 _execute.record_gradient( 

116 "Copy", _inputs_flat, _attrs, _result) 

117 _result, = _result 

118 return _result 

119 

120 

121def copy_host(input, tensor_name="", debug_ops_spec=[], name=None): 

122 r"""Copy a tensor to host. 

123 

124 Performs CPU-to-CPU deep-copying of tensor. 

125 N.B.: If the all downstream attached debug ops are disabled given the current 

126 gRPC gating status, the output will simply forward the input tensor without 

127 deep-copying. See the documentation of Debug* ops for more details. 

128 

129 Unlike the Copy Op, this op has HostMemory constraint on its input or output. 

130 

131 Args: 

132 input: A `Tensor`. Input tensor. 

133 tensor_name: An optional `string`. Defaults to `""`. 

134 The name of the input tensor. 

135 debug_ops_spec: An optional list of `strings`. Defaults to `[]`. 

136 A list of debug op spec (op, url, gated_grpc) for attached debug 

137 ops. Each element of the list has the format 

138 <debug_op>;<grpc_url>;<gated_grpc>, wherein gated_grpc is boolean represented 

139 as 0/1. E.g., "DebugIdentity;grpc://foo:3333;1", 

140 "DebugIdentity;file:///tmp/tfdbg_1;0". 

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

142 

143 Returns: 

144 A `Tensor`. Has the same type as `input`. 

145 """ 

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

147 tld = _ctx._thread_local_data 

148 if tld.is_eager: 

149 try: 

150 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

151 _ctx, "CopyHost", name, input, "tensor_name", tensor_name, 

152 "debug_ops_spec", debug_ops_spec) 

153 return _result 

154 except _core._NotOkStatusException as e: 

155 _ops.raise_from_not_ok_status(e, name) 

156 except _core._FallbackException: 

157 pass 

158 try: 

159 return copy_host_eager_fallback( 

160 input, tensor_name=tensor_name, debug_ops_spec=debug_ops_spec, 

161 name=name, ctx=_ctx) 

162 except _core._SymbolicException: 

163 pass # Add nodes to the TensorFlow graph. 

164 # Add nodes to the TensorFlow graph. 

165 if tensor_name is None: 

166 tensor_name = "" 

167 tensor_name = _execute.make_str(tensor_name, "tensor_name") 

168 if debug_ops_spec is None: 

169 debug_ops_spec = [] 

170 if not isinstance(debug_ops_spec, (list, tuple)): 

171 raise TypeError( 

172 "Expected list for 'debug_ops_spec' argument to " 

173 "'copy_host' Op, not %r." % debug_ops_spec) 

174 debug_ops_spec = [_execute.make_str(_s, "debug_ops_spec") for _s in debug_ops_spec] 

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

176 "CopyHost", input=input, tensor_name=tensor_name, 

177 debug_ops_spec=debug_ops_spec, name=name) 

178 _result = _outputs[:] 

179 if _execute.must_record_gradient(): 

180 _attrs = ("T", _op._get_attr_type("T"), "tensor_name", 

181 _op.get_attr("tensor_name"), "debug_ops_spec", 

182 _op.get_attr("debug_ops_spec")) 

183 _inputs_flat = _op.inputs 

184 _execute.record_gradient( 

185 "CopyHost", _inputs_flat, _attrs, _result) 

186 _result, = _result 

187 return _result 

188 

189CopyHost = tf_export("raw_ops.CopyHost")(_ops.to_raw_op(copy_host)) 

190 

191 

192def copy_host_eager_fallback(input, tensor_name, debug_ops_spec, name, ctx): 

193 if tensor_name is None: 

194 tensor_name = "" 

195 tensor_name = _execute.make_str(tensor_name, "tensor_name") 

196 if debug_ops_spec is None: 

197 debug_ops_spec = [] 

198 if not isinstance(debug_ops_spec, (list, tuple)): 

199 raise TypeError( 

200 "Expected list for 'debug_ops_spec' argument to " 

201 "'copy_host' Op, not %r." % debug_ops_spec) 

202 debug_ops_spec = [_execute.make_str(_s, "debug_ops_spec") for _s in debug_ops_spec] 

203 _attr_T, (input,) = _execute.args_to_matching_eager([input], ctx, []) 

204 _inputs_flat = [input] 

205 _attrs = ("T", _attr_T, "tensor_name", tensor_name, "debug_ops_spec", 

206 debug_ops_spec) 

207 _result = _execute.execute(b"CopyHost", 1, inputs=_inputs_flat, 

208 attrs=_attrs, ctx=ctx, name=name) 

209 if _execute.must_record_gradient(): 

210 _execute.record_gradient( 

211 "CopyHost", _inputs_flat, _attrs, _result) 

212 _result, = _result 

213 return _result 

214 

215 

216def debug_identity(input, device_name="", tensor_name="", debug_urls=[], gated_grpc=False, name=None): 

217 r"""Provides an identity mapping of the non-Ref type input tensor for debugging. 

218 

219 Provides an identity mapping of the non-Ref type input tensor for debugging. 

220 

221 Args: 

222 input: A `Tensor`. Input tensor, non-Reference type 

223 device_name: An optional `string`. Defaults to `""`. 

224 Name of the device on which the tensor resides. 

225 tensor_name: An optional `string`. Defaults to `""`. 

226 Name of the input tensor. 

227 debug_urls: An optional list of `strings`. Defaults to `[]`. 

228 List of URLs to debug targets, e.g., 

229 file:///foo/tfdbg_dump, grpc:://localhost:11011 

230 gated_grpc: An optional `bool`. Defaults to `False`. 

231 Whether this op will be gated. If any of the debug_urls of this 

232 debug node is of the grpc:// scheme, when the value of this attribute is set 

233 to True, the data will not actually be sent via the grpc stream unless this 

234 debug op has been enabled at the debug_url. If all of the debug_urls of this 

235 debug node are of the grpc:// scheme and the debug op is enabled at none of 

236 them, the output will be an empty Tensor. 

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

238 

239 Returns: 

240 A `Tensor`. Has the same type as `input`. 

241 """ 

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

243 tld = _ctx._thread_local_data 

244 if tld.is_eager: 

245 try: 

246 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

247 _ctx, "DebugIdentity", name, input, "device_name", device_name, 

248 "tensor_name", tensor_name, "debug_urls", debug_urls, "gated_grpc", 

249 gated_grpc) 

250 return _result 

251 except _core._NotOkStatusException as e: 

252 _ops.raise_from_not_ok_status(e, name) 

253 except _core._FallbackException: 

254 pass 

255 try: 

256 return debug_identity_eager_fallback( 

257 input, device_name=device_name, tensor_name=tensor_name, 

258 debug_urls=debug_urls, gated_grpc=gated_grpc, name=name, ctx=_ctx) 

259 except _core._SymbolicException: 

260 pass # Add nodes to the TensorFlow graph. 

261 # Add nodes to the TensorFlow graph. 

262 if device_name is None: 

263 device_name = "" 

264 device_name = _execute.make_str(device_name, "device_name") 

265 if tensor_name is None: 

266 tensor_name = "" 

267 tensor_name = _execute.make_str(tensor_name, "tensor_name") 

268 if debug_urls is None: 

269 debug_urls = [] 

270 if not isinstance(debug_urls, (list, tuple)): 

271 raise TypeError( 

272 "Expected list for 'debug_urls' argument to " 

273 "'debug_identity' Op, not %r." % debug_urls) 

274 debug_urls = [_execute.make_str(_s, "debug_urls") for _s in debug_urls] 

275 if gated_grpc is None: 

276 gated_grpc = False 

277 gated_grpc = _execute.make_bool(gated_grpc, "gated_grpc") 

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

279 "DebugIdentity", input=input, device_name=device_name, 

280 tensor_name=tensor_name, debug_urls=debug_urls, 

281 gated_grpc=gated_grpc, name=name) 

282 _result = _outputs[:] 

283 if _execute.must_record_gradient(): 

284 _attrs = ("T", _op._get_attr_type("T"), "device_name", 

285 _op.get_attr("device_name"), "tensor_name", 

286 _op.get_attr("tensor_name"), "debug_urls", 

287 _op.get_attr("debug_urls"), "gated_grpc", 

288 _op._get_attr_bool("gated_grpc")) 

289 _inputs_flat = _op.inputs 

290 _execute.record_gradient( 

291 "DebugIdentity", _inputs_flat, _attrs, _result) 

292 _result, = _result 

293 return _result 

294 

295DebugIdentity = tf_export("raw_ops.DebugIdentity")(_ops.to_raw_op(debug_identity)) 

296 

297 

298def debug_identity_eager_fallback(input, device_name, tensor_name, debug_urls, gated_grpc, name, ctx): 

299 if device_name is None: 

300 device_name = "" 

301 device_name = _execute.make_str(device_name, "device_name") 

302 if tensor_name is None: 

303 tensor_name = "" 

304 tensor_name = _execute.make_str(tensor_name, "tensor_name") 

305 if debug_urls is None: 

306 debug_urls = [] 

307 if not isinstance(debug_urls, (list, tuple)): 

308 raise TypeError( 

309 "Expected list for 'debug_urls' argument to " 

310 "'debug_identity' Op, not %r." % debug_urls) 

311 debug_urls = [_execute.make_str(_s, "debug_urls") for _s in debug_urls] 

312 if gated_grpc is None: 

313 gated_grpc = False 

314 gated_grpc = _execute.make_bool(gated_grpc, "gated_grpc") 

315 _attr_T, (input,) = _execute.args_to_matching_eager([input], ctx, []) 

316 _inputs_flat = [input] 

317 _attrs = ("T", _attr_T, "device_name", device_name, "tensor_name", 

318 tensor_name, "debug_urls", debug_urls, "gated_grpc", gated_grpc) 

319 _result = _execute.execute(b"DebugIdentity", 1, inputs=_inputs_flat, 

320 attrs=_attrs, ctx=ctx, name=name) 

321 if _execute.must_record_gradient(): 

322 _execute.record_gradient( 

323 "DebugIdentity", _inputs_flat, _attrs, _result) 

324 _result, = _result 

325 return _result 

326 

327 

328def debug_identity_v2(input, tfdbg_context_id="", op_name="", output_slot=-1, tensor_debug_mode=-1, debug_urls=[], circular_buffer_size=1000, tfdbg_run_id="", name=None): 

329 r"""Debug Identity V2 Op. 

330 

331 Provides an identity mapping from input to output, while writing the content of 

332 the input tensor by calling DebugEventsWriter. 

333 

334 The semantics of the input tensor depends on tensor_debug_mode. In typical 

335 usage, the input tensor comes directly from the user computation only when 

336 graph_debug_mode is FULL_TENSOR (see protobuf/debug_event.proto for a 

337 list of all the possible values of graph_debug_mode). For the other debug modes, 

338 the input tensor should be produced by an additional op or subgraph that 

339 computes summary information about one or more tensors. 

340 

341 Args: 

342 input: A `Tensor`. Input tensor, non-Reference type 

343 tfdbg_context_id: An optional `string`. Defaults to `""`. 

344 A tfdbg-generated ID for the context that the op belongs to, 

345 e.g., a concrete compiled tf.function. 

346 op_name: An optional `string`. Defaults to `""`. 

347 Optional. Name of the op that the debug op is concerned with. 

348 Used only for single-tensor trace. 

349 output_slot: An optional `int`. Defaults to `-1`. 

350 Optional. Output slot index of the tensor that the debug op 

351 is concerned with. Used only for single-tensor trace. 

352 tensor_debug_mode: An optional `int`. Defaults to `-1`. 

353 TensorDebugMode enum value. See debug_event.proto for details. 

354 debug_urls: An optional list of `strings`. Defaults to `[]`. 

355 List of URLs to debug targets, e.g., file:///foo/tfdbg_dump. 

356 circular_buffer_size: An optional `int`. Defaults to `1000`. 

357 tfdbg_run_id: An optional `string`. Defaults to `""`. 

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

359 

360 Returns: 

361 A `Tensor`. Has the same type as `input`. 

362 """ 

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

364 tld = _ctx._thread_local_data 

365 if tld.is_eager: 

366 try: 

367 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

368 _ctx, "DebugIdentityV2", name, input, "tfdbg_context_id", 

369 tfdbg_context_id, "op_name", op_name, "output_slot", output_slot, 

370 "tensor_debug_mode", tensor_debug_mode, "debug_urls", debug_urls, 

371 "circular_buffer_size", circular_buffer_size, "tfdbg_run_id", 

372 tfdbg_run_id) 

373 return _result 

374 except _core._NotOkStatusException as e: 

375 _ops.raise_from_not_ok_status(e, name) 

376 except _core._FallbackException: 

377 pass 

378 try: 

379 return debug_identity_v2_eager_fallback( 

380 input, tfdbg_context_id=tfdbg_context_id, op_name=op_name, 

381 output_slot=output_slot, tensor_debug_mode=tensor_debug_mode, 

382 debug_urls=debug_urls, circular_buffer_size=circular_buffer_size, 

383 tfdbg_run_id=tfdbg_run_id, name=name, ctx=_ctx) 

384 except _core._SymbolicException: 

385 pass # Add nodes to the TensorFlow graph. 

386 # Add nodes to the TensorFlow graph. 

387 if tfdbg_context_id is None: 

388 tfdbg_context_id = "" 

389 tfdbg_context_id = _execute.make_str(tfdbg_context_id, "tfdbg_context_id") 

390 if op_name is None: 

391 op_name = "" 

392 op_name = _execute.make_str(op_name, "op_name") 

393 if output_slot is None: 

394 output_slot = -1 

395 output_slot = _execute.make_int(output_slot, "output_slot") 

396 if tensor_debug_mode is None: 

397 tensor_debug_mode = -1 

398 tensor_debug_mode = _execute.make_int(tensor_debug_mode, "tensor_debug_mode") 

399 if debug_urls is None: 

400 debug_urls = [] 

401 if not isinstance(debug_urls, (list, tuple)): 

402 raise TypeError( 

403 "Expected list for 'debug_urls' argument to " 

404 "'debug_identity_v2' Op, not %r." % debug_urls) 

405 debug_urls = [_execute.make_str(_s, "debug_urls") for _s in debug_urls] 

406 if circular_buffer_size is None: 

407 circular_buffer_size = 1000 

408 circular_buffer_size = _execute.make_int(circular_buffer_size, "circular_buffer_size") 

409 if tfdbg_run_id is None: 

410 tfdbg_run_id = "" 

411 tfdbg_run_id = _execute.make_str(tfdbg_run_id, "tfdbg_run_id") 

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

413 "DebugIdentityV2", input=input, tfdbg_context_id=tfdbg_context_id, 

414 op_name=op_name, output_slot=output_slot, 

415 tensor_debug_mode=tensor_debug_mode, 

416 debug_urls=debug_urls, 

417 circular_buffer_size=circular_buffer_size, 

418 tfdbg_run_id=tfdbg_run_id, name=name) 

419 _result = _outputs[:] 

420 if _execute.must_record_gradient(): 

421 _attrs = ("T", _op._get_attr_type("T"), "tfdbg_context_id", 

422 _op.get_attr("tfdbg_context_id"), "op_name", 

423 _op.get_attr("op_name"), "output_slot", 

424 _op._get_attr_int("output_slot"), "tensor_debug_mode", 

425 _op._get_attr_int("tensor_debug_mode"), "debug_urls", 

426 _op.get_attr("debug_urls"), "circular_buffer_size", 

427 _op._get_attr_int("circular_buffer_size"), "tfdbg_run_id", 

428 _op.get_attr("tfdbg_run_id")) 

429 _inputs_flat = _op.inputs 

430 _execute.record_gradient( 

431 "DebugIdentityV2", _inputs_flat, _attrs, _result) 

432 _result, = _result 

433 return _result 

434 

435DebugIdentityV2 = tf_export("raw_ops.DebugIdentityV2")(_ops.to_raw_op(debug_identity_v2)) 

436 

437 

438def debug_identity_v2_eager_fallback(input, tfdbg_context_id, op_name, output_slot, tensor_debug_mode, debug_urls, circular_buffer_size, tfdbg_run_id, name, ctx): 

439 if tfdbg_context_id is None: 

440 tfdbg_context_id = "" 

441 tfdbg_context_id = _execute.make_str(tfdbg_context_id, "tfdbg_context_id") 

442 if op_name is None: 

443 op_name = "" 

444 op_name = _execute.make_str(op_name, "op_name") 

445 if output_slot is None: 

446 output_slot = -1 

447 output_slot = _execute.make_int(output_slot, "output_slot") 

448 if tensor_debug_mode is None: 

449 tensor_debug_mode = -1 

450 tensor_debug_mode = _execute.make_int(tensor_debug_mode, "tensor_debug_mode") 

451 if debug_urls is None: 

452 debug_urls = [] 

453 if not isinstance(debug_urls, (list, tuple)): 

454 raise TypeError( 

455 "Expected list for 'debug_urls' argument to " 

456 "'debug_identity_v2' Op, not %r." % debug_urls) 

457 debug_urls = [_execute.make_str(_s, "debug_urls") for _s in debug_urls] 

458 if circular_buffer_size is None: 

459 circular_buffer_size = 1000 

460 circular_buffer_size = _execute.make_int(circular_buffer_size, "circular_buffer_size") 

461 if tfdbg_run_id is None: 

462 tfdbg_run_id = "" 

463 tfdbg_run_id = _execute.make_str(tfdbg_run_id, "tfdbg_run_id") 

464 _attr_T, (input,) = _execute.args_to_matching_eager([input], ctx, []) 

465 _inputs_flat = [input] 

466 _attrs = ("T", _attr_T, "tfdbg_context_id", tfdbg_context_id, "op_name", 

467 op_name, "output_slot", output_slot, "tensor_debug_mode", tensor_debug_mode, 

468 "debug_urls", debug_urls, "circular_buffer_size", circular_buffer_size, 

469 "tfdbg_run_id", tfdbg_run_id) 

470 _result = _execute.execute(b"DebugIdentityV2", 1, inputs=_inputs_flat, 

471 attrs=_attrs, ctx=ctx, name=name) 

472 if _execute.must_record_gradient(): 

473 _execute.record_gradient( 

474 "DebugIdentityV2", _inputs_flat, _attrs, _result) 

475 _result, = _result 

476 return _result 

477 

478 

479def debug_identity_v3(input, device_name="", tensor_name="", io_of_node="", is_input=False, io_index=-1, debug_urls=[], gated_grpc=False, name=None): 

480 r"""Provides an identity mapping of the non-Ref type input tensor for debugging. 

481 

482 Provides an identity mapping of the non-Ref type input tensor for debugging. 

483 

484 Args: 

485 input: A `Tensor`. Input tensor, non-Reference type 

486 device_name: An optional `string`. Defaults to `""`. 

487 Name of the device on which the tensor resides. 

488 tensor_name: An optional `string`. Defaults to `""`. 

489 Name of the input tensor. 

490 io_of_node: An optional `string`. Defaults to `""`. 

491 Name of the node of which the tensor is an input or output. 

492 is_input: An optional `bool`. Defaults to `False`. 

493 If true, the tensor is an input of the node; otherwise the output. 

494 io_index: An optional `int`. Defaults to `-1`. 

495 The index of which the tensor is an input or output of the node. 

496 debug_urls: An optional list of `strings`. Defaults to `[]`. 

497 List of URLs to debug targets, e.g., 

498 file:///foo/tfdbg_dump, grpc:://localhost:11011 

499 gated_grpc: An optional `bool`. Defaults to `False`. 

500 Whether this op will be gated. If any of the debug_urls of this 

501 debug node is of the grpc:// scheme, when the value of this attribute is set 

502 to True, the data will not actually be sent via the grpc stream unless this 

503 debug op has been enabled at the debug_url. If all of the debug_urls of this 

504 debug node are of the grpc:// scheme and the debug op is enabled at none of 

505 them, the output will be an empty Tensor. 

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

507 

508 Returns: 

509 A `Tensor`. Has the same type as `input`. 

510 """ 

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

512 tld = _ctx._thread_local_data 

513 if tld.is_eager: 

514 try: 

515 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

516 _ctx, "DebugIdentityV3", name, input, "device_name", device_name, 

517 "tensor_name", tensor_name, "io_of_node", io_of_node, "is_input", 

518 is_input, "io_index", io_index, "debug_urls", debug_urls, 

519 "gated_grpc", gated_grpc) 

520 return _result 

521 except _core._NotOkStatusException as e: 

522 _ops.raise_from_not_ok_status(e, name) 

523 except _core._FallbackException: 

524 pass 

525 try: 

526 return debug_identity_v3_eager_fallback( 

527 input, device_name=device_name, tensor_name=tensor_name, 

528 io_of_node=io_of_node, is_input=is_input, io_index=io_index, 

529 debug_urls=debug_urls, gated_grpc=gated_grpc, name=name, ctx=_ctx) 

530 except _core._SymbolicException: 

531 pass # Add nodes to the TensorFlow graph. 

532 # Add nodes to the TensorFlow graph. 

533 if device_name is None: 

534 device_name = "" 

535 device_name = _execute.make_str(device_name, "device_name") 

536 if tensor_name is None: 

537 tensor_name = "" 

538 tensor_name = _execute.make_str(tensor_name, "tensor_name") 

539 if io_of_node is None: 

540 io_of_node = "" 

541 io_of_node = _execute.make_str(io_of_node, "io_of_node") 

542 if is_input is None: 

543 is_input = False 

544 is_input = _execute.make_bool(is_input, "is_input") 

545 if io_index is None: 

546 io_index = -1 

547 io_index = _execute.make_int(io_index, "io_index") 

548 if debug_urls is None: 

549 debug_urls = [] 

550 if not isinstance(debug_urls, (list, tuple)): 

551 raise TypeError( 

552 "Expected list for 'debug_urls' argument to " 

553 "'debug_identity_v3' Op, not %r." % debug_urls) 

554 debug_urls = [_execute.make_str(_s, "debug_urls") for _s in debug_urls] 

555 if gated_grpc is None: 

556 gated_grpc = False 

557 gated_grpc = _execute.make_bool(gated_grpc, "gated_grpc") 

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

559 "DebugIdentityV3", input=input, device_name=device_name, 

560 tensor_name=tensor_name, io_of_node=io_of_node, 

561 is_input=is_input, io_index=io_index, 

562 debug_urls=debug_urls, gated_grpc=gated_grpc, 

563 name=name) 

564 _result = _outputs[:] 

565 if _execute.must_record_gradient(): 

566 _attrs = ("T", _op._get_attr_type("T"), "device_name", 

567 _op.get_attr("device_name"), "tensor_name", 

568 _op.get_attr("tensor_name"), "io_of_node", 

569 _op.get_attr("io_of_node"), "is_input", 

570 _op._get_attr_bool("is_input"), "io_index", 

571 _op._get_attr_int("io_index"), "debug_urls", 

572 _op.get_attr("debug_urls"), "gated_grpc", 

573 _op._get_attr_bool("gated_grpc")) 

574 _inputs_flat = _op.inputs 

575 _execute.record_gradient( 

576 "DebugIdentityV3", _inputs_flat, _attrs, _result) 

577 _result, = _result 

578 return _result 

579 

580DebugIdentityV3 = tf_export("raw_ops.DebugIdentityV3")(_ops.to_raw_op(debug_identity_v3)) 

581 

582 

583def debug_identity_v3_eager_fallback(input, device_name, tensor_name, io_of_node, is_input, io_index, debug_urls, gated_grpc, name, ctx): 

584 if device_name is None: 

585 device_name = "" 

586 device_name = _execute.make_str(device_name, "device_name") 

587 if tensor_name is None: 

588 tensor_name = "" 

589 tensor_name = _execute.make_str(tensor_name, "tensor_name") 

590 if io_of_node is None: 

591 io_of_node = "" 

592 io_of_node = _execute.make_str(io_of_node, "io_of_node") 

593 if is_input is None: 

594 is_input = False 

595 is_input = _execute.make_bool(is_input, "is_input") 

596 if io_index is None: 

597 io_index = -1 

598 io_index = _execute.make_int(io_index, "io_index") 

599 if debug_urls is None: 

600 debug_urls = [] 

601 if not isinstance(debug_urls, (list, tuple)): 

602 raise TypeError( 

603 "Expected list for 'debug_urls' argument to " 

604 "'debug_identity_v3' Op, not %r." % debug_urls) 

605 debug_urls = [_execute.make_str(_s, "debug_urls") for _s in debug_urls] 

606 if gated_grpc is None: 

607 gated_grpc = False 

608 gated_grpc = _execute.make_bool(gated_grpc, "gated_grpc") 

609 _attr_T, (input,) = _execute.args_to_matching_eager([input], ctx, []) 

610 _inputs_flat = [input] 

611 _attrs = ("T", _attr_T, "device_name", device_name, "tensor_name", 

612 tensor_name, "io_of_node", io_of_node, "is_input", is_input, "io_index", 

613 io_index, "debug_urls", debug_urls, "gated_grpc", gated_grpc) 

614 _result = _execute.execute(b"DebugIdentityV3", 1, inputs=_inputs_flat, 

615 attrs=_attrs, ctx=ctx, name=name) 

616 if _execute.must_record_gradient(): 

617 _execute.record_gradient( 

618 "DebugIdentityV3", _inputs_flat, _attrs, _result) 

619 _result, = _result 

620 return _result 

621 

622 

623def debug_nan_count(input, device_name="", tensor_name="", debug_urls=[], gated_grpc=False, name=None): 

624 r"""Debug NaN Value Counter Op. 

625 

626 Counts number of NaNs in the input tensor, for debugging. 

627 

628 Args: 

629 input: A `Tensor`. Input tensor, non-Reference type. 

630 device_name: An optional `string`. Defaults to `""`. 

631 tensor_name: An optional `string`. Defaults to `""`. 

632 Name of the input tensor. 

633 debug_urls: An optional list of `strings`. Defaults to `[]`. 

634 List of URLs to debug targets, e.g., 

635 file:///foo/tfdbg_dump, grpc:://localhost:11011. 

636 gated_grpc: An optional `bool`. Defaults to `False`. 

637 Whether this op will be gated. If any of the debug_urls of this 

638 debug node is of the grpc:// scheme, when the value of this attribute is set 

639 to True, the data will not actually be sent via the grpc stream unless this 

640 debug op has been enabled at the debug_url. If all of the debug_urls of this 

641 debug node are of the grpc:// scheme and the debug op is enabled at none of 

642 them, the output will be an empty Tensor. 

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

644 

645 Returns: 

646 A `Tensor` of type `int64`. 

647 """ 

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

649 tld = _ctx._thread_local_data 

650 if tld.is_eager: 

651 try: 

652 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

653 _ctx, "DebugNanCount", name, input, "device_name", device_name, 

654 "tensor_name", tensor_name, "debug_urls", debug_urls, "gated_grpc", 

655 gated_grpc) 

656 return _result 

657 except _core._NotOkStatusException as e: 

658 _ops.raise_from_not_ok_status(e, name) 

659 except _core._FallbackException: 

660 pass 

661 try: 

662 return debug_nan_count_eager_fallback( 

663 input, device_name=device_name, tensor_name=tensor_name, 

664 debug_urls=debug_urls, gated_grpc=gated_grpc, name=name, ctx=_ctx) 

665 except _core._SymbolicException: 

666 pass # Add nodes to the TensorFlow graph. 

667 # Add nodes to the TensorFlow graph. 

668 if device_name is None: 

669 device_name = "" 

670 device_name = _execute.make_str(device_name, "device_name") 

671 if tensor_name is None: 

672 tensor_name = "" 

673 tensor_name = _execute.make_str(tensor_name, "tensor_name") 

674 if debug_urls is None: 

675 debug_urls = [] 

676 if not isinstance(debug_urls, (list, tuple)): 

677 raise TypeError( 

678 "Expected list for 'debug_urls' argument to " 

679 "'debug_nan_count' Op, not %r." % debug_urls) 

680 debug_urls = [_execute.make_str(_s, "debug_urls") for _s in debug_urls] 

681 if gated_grpc is None: 

682 gated_grpc = False 

683 gated_grpc = _execute.make_bool(gated_grpc, "gated_grpc") 

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

685 "DebugNanCount", input=input, device_name=device_name, 

686 tensor_name=tensor_name, debug_urls=debug_urls, 

687 gated_grpc=gated_grpc, name=name) 

688 _result = _outputs[:] 

689 if _execute.must_record_gradient(): 

690 _attrs = ("T", _op._get_attr_type("T"), "device_name", 

691 _op.get_attr("device_name"), "tensor_name", 

692 _op.get_attr("tensor_name"), "debug_urls", 

693 _op.get_attr("debug_urls"), "gated_grpc", 

694 _op._get_attr_bool("gated_grpc")) 

695 _inputs_flat = _op.inputs 

696 _execute.record_gradient( 

697 "DebugNanCount", _inputs_flat, _attrs, _result) 

698 _result, = _result 

699 return _result 

700 

701DebugNanCount = tf_export("raw_ops.DebugNanCount")(_ops.to_raw_op(debug_nan_count)) 

702 

703 

704def debug_nan_count_eager_fallback(input, device_name, tensor_name, debug_urls, gated_grpc, name, ctx): 

705 if device_name is None: 

706 device_name = "" 

707 device_name = _execute.make_str(device_name, "device_name") 

708 if tensor_name is None: 

709 tensor_name = "" 

710 tensor_name = _execute.make_str(tensor_name, "tensor_name") 

711 if debug_urls is None: 

712 debug_urls = [] 

713 if not isinstance(debug_urls, (list, tuple)): 

714 raise TypeError( 

715 "Expected list for 'debug_urls' argument to " 

716 "'debug_nan_count' Op, not %r." % debug_urls) 

717 debug_urls = [_execute.make_str(_s, "debug_urls") for _s in debug_urls] 

718 if gated_grpc is None: 

719 gated_grpc = False 

720 gated_grpc = _execute.make_bool(gated_grpc, "gated_grpc") 

721 _attr_T, (input,) = _execute.args_to_matching_eager([input], ctx, []) 

722 _inputs_flat = [input] 

723 _attrs = ("T", _attr_T, "device_name", device_name, "tensor_name", 

724 tensor_name, "debug_urls", debug_urls, "gated_grpc", gated_grpc) 

725 _result = _execute.execute(b"DebugNanCount", 1, inputs=_inputs_flat, 

726 attrs=_attrs, ctx=ctx, name=name) 

727 if _execute.must_record_gradient(): 

728 _execute.record_gradient( 

729 "DebugNanCount", _inputs_flat, _attrs, _result) 

730 _result, = _result 

731 return _result 

732 

733 

734def debug_numeric_summary(input, device_name="", tensor_name="", debug_urls=[], lower_bound=float('-inf'), upper_bound=float('inf'), mute_if_healthy=False, gated_grpc=False, name=None): 

735 r"""Debug Numeric Summary Op. 

736 

737 Provide a basic summary of numeric value types, range and distribution. 

738 

739 output: A double tensor of shape [14 + nDimensions], where nDimensions is the 

740 number of dimensions of the tensor's shape. The elements of output are: 

741 [0]: is initialized (1.0) or not (0.0). 

742 [1]: total number of elements 

743 [2]: NaN element count 

744 [3]: generalized -inf count: elements <= lower_bound. lower_bound is -inf by 

745 default. 

746 [4]: negative element count (excluding -inf), if lower_bound is the default 

747 -inf. Otherwise, this is the count of elements > lower_bound and < 0. 

748 [5]: zero element count 

749 [6]: positive element count (excluding +inf), if upper_bound is the default 

750 +inf. Otherwise, this is the count of elements < upper_bound and > 0. 

751 [7]: generalized +inf count, elements >= upper_bound. upper_bound is +inf by 

752 default. 

753 Output elements [1:8] are all zero, if the tensor is uninitialized. 

754 [8]: minimum of all non-inf and non-NaN elements. 

755 If uninitialized or no such element exists: +inf. 

756 [9]: maximum of all non-inf and non-NaN elements. 

757 If uninitialized or no such element exists: -inf. 

758 [10]: mean of all non-inf and non-NaN elements. 

759 If uninitialized or no such element exists: NaN. 

760 [11]: variance of all non-inf and non-NaN elements. 

761 If uninitialized or no such element exists: NaN. 

762 [12]: Data type of the tensor encoded as an enum integer. See the DataType 

763 proto for more details. 

764 [13]: Number of dimensions of the tensor (ndims). 

765 [14+]: Sizes of the dimensions. 

766 

767 Args: 

768 input: A `Tensor`. Input tensor, non-Reference type. 

769 device_name: An optional `string`. Defaults to `""`. 

770 tensor_name: An optional `string`. Defaults to `""`. 

771 Name of the input tensor. 

772 debug_urls: An optional list of `strings`. Defaults to `[]`. 

773 List of URLs to debug targets, e.g., 

774 file:///foo/tfdbg_dump, grpc:://localhost:11011. 

775 lower_bound: An optional `float`. Defaults to `float('-inf')`. 

776 (float) The lower bound <= which values will be included in the 

777 generalized -inf count. Default: -inf. 

778 upper_bound: An optional `float`. Defaults to `float('inf')`. 

779 (float) The upper bound >= which values will be included in the 

780 generalized +inf count. Default: +inf. 

781 mute_if_healthy: An optional `bool`. Defaults to `False`. 

782 (bool) Do not send data to the debug URLs unless at least one 

783 of elements [2], [3] and [7] (i.e., the nan count and the generalized -inf and 

784 inf counts) is non-zero. 

785 gated_grpc: An optional `bool`. Defaults to `False`. 

786 Whether this op will be gated. If any of the debug_urls of this 

787 debug node is of the grpc:// scheme, when the value of this attribute is set 

788 to True, the data will not actually be sent via the grpc stream unless this 

789 debug op has been enabled at the debug_url. If all of the debug_urls of this 

790 debug node are of the grpc:// scheme and the debug op is enabled at none of 

791 them, the output will be an empty Tensor. 

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

793 

794 Returns: 

795 A `Tensor` of type `float64`. 

796 """ 

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

798 tld = _ctx._thread_local_data 

799 if tld.is_eager: 

800 try: 

801 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

802 _ctx, "DebugNumericSummary", name, input, "device_name", device_name, 

803 "tensor_name", tensor_name, "debug_urls", debug_urls, "lower_bound", 

804 lower_bound, "upper_bound", upper_bound, "mute_if_healthy", 

805 mute_if_healthy, "gated_grpc", gated_grpc) 

806 return _result 

807 except _core._NotOkStatusException as e: 

808 _ops.raise_from_not_ok_status(e, name) 

809 except _core._FallbackException: 

810 pass 

811 try: 

812 return debug_numeric_summary_eager_fallback( 

813 input, device_name=device_name, tensor_name=tensor_name, 

814 debug_urls=debug_urls, lower_bound=lower_bound, 

815 upper_bound=upper_bound, mute_if_healthy=mute_if_healthy, 

816 gated_grpc=gated_grpc, name=name, ctx=_ctx) 

817 except _core._SymbolicException: 

818 pass # Add nodes to the TensorFlow graph. 

819 # Add nodes to the TensorFlow graph. 

820 if device_name is None: 

821 device_name = "" 

822 device_name = _execute.make_str(device_name, "device_name") 

823 if tensor_name is None: 

824 tensor_name = "" 

825 tensor_name = _execute.make_str(tensor_name, "tensor_name") 

826 if debug_urls is None: 

827 debug_urls = [] 

828 if not isinstance(debug_urls, (list, tuple)): 

829 raise TypeError( 

830 "Expected list for 'debug_urls' argument to " 

831 "'debug_numeric_summary' Op, not %r." % debug_urls) 

832 debug_urls = [_execute.make_str(_s, "debug_urls") for _s in debug_urls] 

833 if lower_bound is None: 

834 lower_bound = float('-inf') 

835 lower_bound = _execute.make_float(lower_bound, "lower_bound") 

836 if upper_bound is None: 

837 upper_bound = float('inf') 

838 upper_bound = _execute.make_float(upper_bound, "upper_bound") 

839 if mute_if_healthy is None: 

840 mute_if_healthy = False 

841 mute_if_healthy = _execute.make_bool(mute_if_healthy, "mute_if_healthy") 

842 if gated_grpc is None: 

843 gated_grpc = False 

844 gated_grpc = _execute.make_bool(gated_grpc, "gated_grpc") 

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

846 "DebugNumericSummary", input=input, device_name=device_name, 

847 tensor_name=tensor_name, debug_urls=debug_urls, 

848 lower_bound=lower_bound, 

849 upper_bound=upper_bound, 

850 mute_if_healthy=mute_if_healthy, 

851 gated_grpc=gated_grpc, name=name) 

852 _result = _outputs[:] 

853 if _execute.must_record_gradient(): 

854 _attrs = ("T", _op._get_attr_type("T"), "device_name", 

855 _op.get_attr("device_name"), "tensor_name", 

856 _op.get_attr("tensor_name"), "debug_urls", 

857 _op.get_attr("debug_urls"), "lower_bound", 

858 _op.get_attr("lower_bound"), "upper_bound", 

859 _op.get_attr("upper_bound"), "mute_if_healthy", 

860 _op._get_attr_bool("mute_if_healthy"), "gated_grpc", 

861 _op._get_attr_bool("gated_grpc")) 

862 _inputs_flat = _op.inputs 

863 _execute.record_gradient( 

864 "DebugNumericSummary", _inputs_flat, _attrs, _result) 

865 _result, = _result 

866 return _result 

867 

868DebugNumericSummary = tf_export("raw_ops.DebugNumericSummary")(_ops.to_raw_op(debug_numeric_summary)) 

869 

870 

871def debug_numeric_summary_eager_fallback(input, device_name, tensor_name, debug_urls, lower_bound, upper_bound, mute_if_healthy, gated_grpc, name, ctx): 

872 if device_name is None: 

873 device_name = "" 

874 device_name = _execute.make_str(device_name, "device_name") 

875 if tensor_name is None: 

876 tensor_name = "" 

877 tensor_name = _execute.make_str(tensor_name, "tensor_name") 

878 if debug_urls is None: 

879 debug_urls = [] 

880 if not isinstance(debug_urls, (list, tuple)): 

881 raise TypeError( 

882 "Expected list for 'debug_urls' argument to " 

883 "'debug_numeric_summary' Op, not %r." % debug_urls) 

884 debug_urls = [_execute.make_str(_s, "debug_urls") for _s in debug_urls] 

885 if lower_bound is None: 

886 lower_bound = float('-inf') 

887 lower_bound = _execute.make_float(lower_bound, "lower_bound") 

888 if upper_bound is None: 

889 upper_bound = float('inf') 

890 upper_bound = _execute.make_float(upper_bound, "upper_bound") 

891 if mute_if_healthy is None: 

892 mute_if_healthy = False 

893 mute_if_healthy = _execute.make_bool(mute_if_healthy, "mute_if_healthy") 

894 if gated_grpc is None: 

895 gated_grpc = False 

896 gated_grpc = _execute.make_bool(gated_grpc, "gated_grpc") 

897 _attr_T, (input,) = _execute.args_to_matching_eager([input], ctx, []) 

898 _inputs_flat = [input] 

899 _attrs = ("T", _attr_T, "device_name", device_name, "tensor_name", 

900 tensor_name, "debug_urls", debug_urls, "lower_bound", lower_bound, 

901 "upper_bound", upper_bound, "mute_if_healthy", mute_if_healthy, 

902 "gated_grpc", gated_grpc) 

903 _result = _execute.execute(b"DebugNumericSummary", 1, inputs=_inputs_flat, 

904 attrs=_attrs, ctx=ctx, name=name) 

905 if _execute.must_record_gradient(): 

906 _execute.record_gradient( 

907 "DebugNumericSummary", _inputs_flat, _attrs, _result) 

908 _result, = _result 

909 return _result 

910 

911 

912def debug_numeric_summary_v2(input, output_dtype=_dtypes.float32, tensor_debug_mode=-1, tensor_id=-1, name=None): 

913 r"""Debug Numeric Summary V2 Op. 

914 

915 Computes a numeric summary of the input tensor. The shape of the output 

916 depends on the tensor_debug_mode attribute. 

917 This op is used internally by TensorFlow Debugger (tfdbg) v2. 

918 

919 Args: 

920 input: A `Tensor`. Input tensor, to be summarized by the op. 

921 output_dtype: An optional `tf.DType` from: `tf.float32, tf.float64`. Defaults to `tf.float32`. 

922 Optional. The type of the output. Can be float32 or float64 (default: float32). 

923 tensor_debug_mode: An optional `int`. Defaults to `-1`. 

924 Tensor debug mode: the mode in which the input tensor is summarized 

925 by the op. See the TensorDebugMode enum in 

926 tensorflow/core/protobuf/debug_event.proto for details. 

927 

928 Supported values: 

929 2 (CURT_HEALTH): Output a float32/64 tensor of shape [2]. The 1st 

930 element is the tensor_id, if provided, and -1 otherwise. The 2nd 

931 element is a bit which is set to 1 if the input tensor has an 

932 infinity or nan value, or zero otherwise. 

933 

934 3 (CONCISE_HEALTH): Output a float32/64 tensor of shape [5]. The 1st 

935 element is the tensor_id, if provided, and -1 otherwise. The 

936 remaining four slots are the total number of elements, -infs, 

937 +infs, and nans in the input tensor respectively. 

938 

939 4 (FULL_HEALTH): Output a float32/64 tensor of shape [11]. The 1st 

940 element is the tensor_id, if provided, and -1 otherwise. The 2nd 

941 element is the device_id, if provided, and -1 otherwise. The 3rd 

942 element holds the datatype value of the input tensor as according 

943 to the enumerated type in tensorflow/core/framework/types.proto. 

944 The remaining elements hold the total number of elements, -infs, 

945 +infs, nans, negative finite numbers, zeros, and positive finite 

946 numbers in the input tensor respectively. 

947 

948 5 (SHAPE): Output a float32/64 tensor of shape [10]. The 1st 

949 element is the tensor_id, if provided, and -1 otherwise. The 2nd 

950 element holds the datatype value of the input tensor as according 

951 to the enumerated type in tensorflow/core/framework/types.proto. 

952 The 3rd element holds the rank of the tensor. The 4th element holds 

953 the number of elements within the tensor. Finally the remaining 6 

954 elements hold the shape of the tensor. If the rank of the tensor 

955 is lower than 6, the shape is right padded with zeros. If the rank 

956 is greater than 6, the head of the shape is truncated. 

957 

958 6 (FULL_NUMERICS): Output a float32/64 tensor of shape [22]. The 1st 

959 element is the tensor_id, if provided, and -1 otherwise. The 2nd 

960 element is the device_id, if provided, and -1 otherwise. The 3rd 

961 element holds the datatype value of the input tensor as according 

962 to the enumerated type in tensorflow/core/framework/types.proto. 

963 The 4th element holds the rank of the tensor. The 5th to 11th 

964 elements hold the shape of the tensor. If the rank of the tensor 

965 is lower than 6, the shape is right padded with zeros. If the rank 

966 is greater than 6, the head of the shape is truncated. The 12th to 

967 18th elements hold the number of elements, -infs, +infs, nans, 

968 denormal floats, negative finite numbers, zeros, and positive 

969 finite numbers in the input tensor respectively. The final four 

970 elements hold the min value, max value, mean, and variance of the 

971 input tensor. 

972 

973 8 (REDUCE_INF_NAN_THREE_SLOTS): Output a float32/64 tensor of shape 

974 [3]. The 1st element is -inf if any elements of the input tensor 

975 is -inf, or zero otherwise. The 2nd element is +inf if any elements 

976 of the input tensor is +inf, or zero otherwise. The 3rd element is 

977 nan if any element of the input tensor is nan, or zero otherwise. 

978 tensor_id: An optional `int`. Defaults to `-1`. 

979 Optional. An integer identifier for the tensor being summarized by this op. 

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

981 

982 Returns: 

983 A `Tensor` of type `output_dtype`. 

984 """ 

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

986 tld = _ctx._thread_local_data 

987 if tld.is_eager: 

988 try: 

989 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

990 _ctx, "DebugNumericSummaryV2", name, input, "output_dtype", 

991 output_dtype, "tensor_debug_mode", tensor_debug_mode, "tensor_id", 

992 tensor_id) 

993 return _result 

994 except _core._NotOkStatusException as e: 

995 _ops.raise_from_not_ok_status(e, name) 

996 except _core._FallbackException: 

997 pass 

998 try: 

999 return debug_numeric_summary_v2_eager_fallback( 

1000 input, output_dtype=output_dtype, 

1001 tensor_debug_mode=tensor_debug_mode, tensor_id=tensor_id, name=name, 

1002 ctx=_ctx) 

1003 except _core._SymbolicException: 

1004 pass # Add nodes to the TensorFlow graph. 

1005 # Add nodes to the TensorFlow graph. 

1006 if output_dtype is None: 

1007 output_dtype = _dtypes.float32 

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

1009 if tensor_debug_mode is None: 

1010 tensor_debug_mode = -1 

1011 tensor_debug_mode = _execute.make_int(tensor_debug_mode, "tensor_debug_mode") 

1012 if tensor_id is None: 

1013 tensor_id = -1 

1014 tensor_id = _execute.make_int(tensor_id, "tensor_id") 

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

1016 "DebugNumericSummaryV2", input=input, output_dtype=output_dtype, 

1017 tensor_debug_mode=tensor_debug_mode, 

1018 tensor_id=tensor_id, name=name) 

1019 _result = _outputs[:] 

1020 if _execute.must_record_gradient(): 

1021 _attrs = ("output_dtype", _op._get_attr_type("output_dtype"), "T", 

1022 _op._get_attr_type("T"), "tensor_debug_mode", 

1023 _op._get_attr_int("tensor_debug_mode"), "tensor_id", 

1024 _op._get_attr_int("tensor_id")) 

1025 _inputs_flat = _op.inputs 

1026 _execute.record_gradient( 

1027 "DebugNumericSummaryV2", _inputs_flat, _attrs, _result) 

1028 _result, = _result 

1029 return _result 

1030 

1031DebugNumericSummaryV2 = tf_export("raw_ops.DebugNumericSummaryV2")(_ops.to_raw_op(debug_numeric_summary_v2)) 

1032 

1033 

1034def debug_numeric_summary_v2_eager_fallback(input, output_dtype, tensor_debug_mode, tensor_id, name, ctx): 

1035 if output_dtype is None: 

1036 output_dtype = _dtypes.float32 

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

1038 if tensor_debug_mode is None: 

1039 tensor_debug_mode = -1 

1040 tensor_debug_mode = _execute.make_int(tensor_debug_mode, "tensor_debug_mode") 

1041 if tensor_id is None: 

1042 tensor_id = -1 

1043 tensor_id = _execute.make_int(tensor_id, "tensor_id") 

1044 _attr_T, (input,) = _execute.args_to_matching_eager([input], ctx, []) 

1045 _inputs_flat = [input] 

1046 _attrs = ("output_dtype", output_dtype, "T", _attr_T, "tensor_debug_mode", 

1047 tensor_debug_mode, "tensor_id", tensor_id) 

1048 _result = _execute.execute(b"DebugNumericSummaryV2", 1, inputs=_inputs_flat, 

1049 attrs=_attrs, ctx=ctx, name=name) 

1050 if _execute.must_record_gradient(): 

1051 _execute.record_gradient( 

1052 "DebugNumericSummaryV2", _inputs_flat, _attrs, _result) 

1053 _result, = _result 

1054 return _result 

1055