Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/tensorflow/distribute/experimental/rpc/kernels/gen_rpc_ops.py: 16%

461 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 

24@_dispatch.add_fallback_dispatch_list 

25@_dispatch.add_type_based_api_dispatcher 

26@tf_export('delete_rpc_future_resource') 

27def delete_rpc_future_resource(handle, deleter, name=None): 

28 r"""TODO: add doc. 

29 

30 Args: 

31 handle: A `Tensor` of type `resource`. 

32 deleter: A `Tensor` of type `variant`. 

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

34 

35 Returns: 

36 The created Operation. 

37 """ 

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

39 tld = _ctx._thread_local_data 

40 if tld.is_eager: 

41 try: 

42 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

43 _ctx, "DeleteRpcFutureResource", name, handle, deleter) 

44 return _result 

45 except _core._NotOkStatusException as e: 

46 _ops.raise_from_not_ok_status(e, name) 

47 except _core._FallbackException: 

48 pass 

49 try: 

50 _result = _dispatcher_for_delete_rpc_future_resource( 

51 (handle, deleter, name,), None) 

52 if _result is not NotImplemented: 

53 return _result 

54 return delete_rpc_future_resource_eager_fallback( 

55 handle, deleter, name=name, ctx=_ctx) 

56 except _core._SymbolicException: 

57 pass # Add nodes to the TensorFlow graph. 

58 except (TypeError, ValueError): 

59 _result = _dispatch.dispatch( 

60 delete_rpc_future_resource, (), dict(handle=handle, 

61 deleter=deleter, name=name) 

62 ) 

63 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED: 

64 return _result 

65 raise 

66 else: 

67 _result = _dispatcher_for_delete_rpc_future_resource( 

68 (handle, deleter, name,), None) 

69 if _result is not NotImplemented: 

70 return _result 

71 # Add nodes to the TensorFlow graph. 

72 try: 

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

74 "DeleteRpcFutureResource", handle=handle, deleter=deleter, name=name) 

75 except (TypeError, ValueError): 

76 _result = _dispatch.dispatch( 

77 delete_rpc_future_resource, (), dict(handle=handle, deleter=deleter, 

78 name=name) 

79 ) 

80 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED: 

81 return _result 

82 raise 

83 return _op 

84DeleteRpcFutureResource = tf_export("raw_ops.DeleteRpcFutureResource")(_ops.to_raw_op(delete_rpc_future_resource)) 

85_dispatcher_for_delete_rpc_future_resource = delete_rpc_future_resource._tf_type_based_dispatcher.Dispatch 

86 

87 

88def delete_rpc_future_resource_eager_fallback(handle, deleter, name, ctx): 

89 handle = _ops.convert_to_tensor(handle, _dtypes.resource) 

90 deleter = _ops.convert_to_tensor(deleter, _dtypes.variant) 

91 _inputs_flat = [handle, deleter] 

92 _attrs = None 

93 _result = _execute.execute(b"DeleteRpcFutureResource", 0, 

94 inputs=_inputs_flat, attrs=_attrs, ctx=ctx, 

95 name=name) 

96 _result = None 

97 return _result 

98 

99_RpcCallOutput = collections.namedtuple( 

100 "RpcCall", 

101 ["future", "deleter"]) 

102 

103 

104@_dispatch.add_fallback_dispatch_list 

105@_dispatch.add_type_based_api_dispatcher 

106@tf_export('rpc_call') 

107def rpc_call(client, method_name, args, timeout_in_ms, name=None): 

108 r"""TODO: add doc. 

109 

110 Args: 

111 client: A `Tensor` of type `resource`. 

112 method_name: A `Tensor` of type `string`. 

113 args: A list of `Tensor` objects. 

114 timeout_in_ms: A `Tensor` of type `int64`. 

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

116 

117 Returns: 

118 A tuple of `Tensor` objects (future, deleter). 

119 

120 future: A `Tensor` of type `resource`. 

121 deleter: A `Tensor` of type `variant`. 

122 """ 

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

124 tld = _ctx._thread_local_data 

125 if tld.is_eager: 

126 try: 

127 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

128 _ctx, "RpcCall", name, client, method_name, args, timeout_in_ms) 

129 _result = _RpcCallOutput._make(_result) 

130 return _result 

131 except _core._NotOkStatusException as e: 

132 _ops.raise_from_not_ok_status(e, name) 

133 except _core._FallbackException: 

134 pass 

135 try: 

136 _result = _dispatcher_for_rpc_call( 

137 (client, method_name, args, timeout_in_ms, name,), None) 

138 if _result is not NotImplemented: 

139 return _result 

140 return rpc_call_eager_fallback( 

141 client, method_name, args, timeout_in_ms, name=name, ctx=_ctx) 

142 except _core._SymbolicException: 

143 pass # Add nodes to the TensorFlow graph. 

144 except (TypeError, ValueError): 

145 _result = _dispatch.dispatch( 

146 rpc_call, (), dict(client=client, method_name=method_name, 

147 args=args, timeout_in_ms=timeout_in_ms, 

148 name=name) 

149 ) 

150 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED: 

151 return _result 

152 raise 

153 else: 

154 _result = _dispatcher_for_rpc_call( 

155 (client, method_name, args, timeout_in_ms, name,), None) 

156 if _result is not NotImplemented: 

157 return _result 

158 # Add nodes to the TensorFlow graph. 

159 try: 

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

161 "RpcCall", client=client, method_name=method_name, args=args, 

162 timeout_in_ms=timeout_in_ms, name=name) 

163 except (TypeError, ValueError): 

164 _result = _dispatch.dispatch( 

165 rpc_call, (), dict(client=client, method_name=method_name, 

166 args=args, timeout_in_ms=timeout_in_ms, 

167 name=name) 

168 ) 

169 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED: 

170 return _result 

171 raise 

172 _result = _outputs[:] 

173 if _execute.must_record_gradient(): 

174 _attrs = ("Tin", _op.get_attr("Tin")) 

175 _inputs_flat = _op.inputs 

176 _execute.record_gradient( 

177 "RpcCall", _inputs_flat, _attrs, _result) 

178 _result = _RpcCallOutput._make(_result) 

179 return _result 

180 

181RpcCall = tf_export("raw_ops.RpcCall")(_ops.to_raw_op(rpc_call)) 

182_dispatcher_for_rpc_call = rpc_call._tf_type_based_dispatcher.Dispatch 

183 

184 

185def rpc_call_eager_fallback(client, method_name, args, timeout_in_ms, name, ctx): 

186 _attr_Tin, args = _execute.convert_to_mixed_eager_tensors(args, ctx) 

187 client = _ops.convert_to_tensor(client, _dtypes.resource) 

188 method_name = _ops.convert_to_tensor(method_name, _dtypes.string) 

189 timeout_in_ms = _ops.convert_to_tensor(timeout_in_ms, _dtypes.int64) 

190 _inputs_flat = [client, method_name] + list(args) + [timeout_in_ms] 

191 _attrs = ("Tin", _attr_Tin) 

192 _result = _execute.execute(b"RpcCall", 2, inputs=_inputs_flat, attrs=_attrs, 

193 ctx=ctx, name=name) 

194 if _execute.must_record_gradient(): 

195 _execute.record_gradient( 

196 "RpcCall", _inputs_flat, _attrs, _result) 

197 _result = _RpcCallOutput._make(_result) 

198 return _result 

199 

200_RpcCheckStatusOutput = collections.namedtuple( 

201 "RpcCheckStatus", 

202 ["error_code", "error"]) 

203 

204 

205@_dispatch.add_fallback_dispatch_list 

206@_dispatch.add_type_based_api_dispatcher 

207@tf_export('rpc_check_status') 

208def rpc_check_status(status_or, name=None): 

209 r"""TODO: add doc. 

210 

211 Args: 

212 status_or: A `Tensor` of type `resource`. 

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

214 

215 Returns: 

216 A tuple of `Tensor` objects (error_code, error). 

217 

218 error_code: A `Tensor` of type `int64`. 

219 error: A `Tensor` of type `string`. 

220 """ 

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

222 tld = _ctx._thread_local_data 

223 if tld.is_eager: 

224 try: 

225 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

226 _ctx, "RpcCheckStatus", name, status_or) 

227 _result = _RpcCheckStatusOutput._make(_result) 

228 return _result 

229 except _core._NotOkStatusException as e: 

230 _ops.raise_from_not_ok_status(e, name) 

231 except _core._FallbackException: 

232 pass 

233 try: 

234 _result = _dispatcher_for_rpc_check_status( 

235 (status_or, name,), None) 

236 if _result is not NotImplemented: 

237 return _result 

238 return rpc_check_status_eager_fallback( 

239 status_or, name=name, ctx=_ctx) 

240 except _core._SymbolicException: 

241 pass # Add nodes to the TensorFlow graph. 

242 except (TypeError, ValueError): 

243 _result = _dispatch.dispatch( 

244 rpc_check_status, (), dict(status_or=status_or, name=name) 

245 ) 

246 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED: 

247 return _result 

248 raise 

249 else: 

250 _result = _dispatcher_for_rpc_check_status( 

251 (status_or, name,), None) 

252 if _result is not NotImplemented: 

253 return _result 

254 # Add nodes to the TensorFlow graph. 

255 try: 

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

257 "RpcCheckStatus", status_or=status_or, name=name) 

258 except (TypeError, ValueError): 

259 _result = _dispatch.dispatch( 

260 rpc_check_status, (), dict(status_or=status_or, name=name) 

261 ) 

262 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED: 

263 return _result 

264 raise 

265 _result = _outputs[:] 

266 if _execute.must_record_gradient(): 

267 _attrs = () 

268 _inputs_flat = _op.inputs 

269 _execute.record_gradient( 

270 "RpcCheckStatus", _inputs_flat, _attrs, _result) 

271 _result = _RpcCheckStatusOutput._make(_result) 

272 return _result 

273 

274RpcCheckStatus = tf_export("raw_ops.RpcCheckStatus")(_ops.to_raw_op(rpc_check_status)) 

275_dispatcher_for_rpc_check_status = rpc_check_status._tf_type_based_dispatcher.Dispatch 

276 

277 

278def rpc_check_status_eager_fallback(status_or, name, ctx): 

279 status_or = _ops.convert_to_tensor(status_or, _dtypes.resource) 

280 _inputs_flat = [status_or] 

281 _attrs = None 

282 _result = _execute.execute(b"RpcCheckStatus", 2, inputs=_inputs_flat, 

283 attrs=_attrs, ctx=ctx, name=name) 

284 if _execute.must_record_gradient(): 

285 _execute.record_gradient( 

286 "RpcCheckStatus", _inputs_flat, _attrs, _result) 

287 _result = _RpcCheckStatusOutput._make(_result) 

288 return _result 

289 

290_RpcClientOutput = collections.namedtuple( 

291 "RpcClient", 

292 ["client", "method_specs"]) 

293 

294 

295@_dispatch.add_fallback_dispatch_list 

296@_dispatch.add_type_based_api_dispatcher 

297@tf_export('rpc_client') 

298def rpc_client(server_address, timeout_in_ms, shared_name="", list_registered_methods=False, name=None): 

299 r"""TODO: add doc. 

300 

301 Args: 

302 server_address: A `Tensor` of type `string`. 

303 timeout_in_ms: A `Tensor` of type `int64`. 

304 shared_name: An optional `string`. Defaults to `""`. 

305 list_registered_methods: An optional `bool`. Defaults to `False`. 

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

307 

308 Returns: 

309 A tuple of `Tensor` objects (client, method_specs). 

310 

311 client: A `Tensor` of type `resource`. 

312 method_specs: A `Tensor` of type `string`. 

313 """ 

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

315 tld = _ctx._thread_local_data 

316 if tld.is_eager: 

317 try: 

318 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

319 _ctx, "RpcClient", name, server_address, timeout_in_ms, "shared_name", 

320 shared_name, "list_registered_methods", list_registered_methods) 

321 _result = _RpcClientOutput._make(_result) 

322 return _result 

323 except _core._NotOkStatusException as e: 

324 _ops.raise_from_not_ok_status(e, name) 

325 except _core._FallbackException: 

326 pass 

327 try: 

328 _result = _dispatcher_for_rpc_client( 

329 (server_address, timeout_in_ms, shared_name, 

330 list_registered_methods, name,), None) 

331 if _result is not NotImplemented: 

332 return _result 

333 return rpc_client_eager_fallback( 

334 server_address, timeout_in_ms, shared_name=shared_name, 

335 list_registered_methods=list_registered_methods, name=name, 

336 ctx=_ctx) 

337 except _core._SymbolicException: 

338 pass # Add nodes to the TensorFlow graph. 

339 except (TypeError, ValueError): 

340 _result = _dispatch.dispatch( 

341 rpc_client, (), dict(server_address=server_address, 

342 timeout_in_ms=timeout_in_ms, 

343 shared_name=shared_name, 

344 list_registered_methods=list_registered_methods, 

345 name=name) 

346 ) 

347 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED: 

348 return _result 

349 raise 

350 else: 

351 _result = _dispatcher_for_rpc_client( 

352 (server_address, timeout_in_ms, shared_name, list_registered_methods, 

353 name,), None) 

354 if _result is not NotImplemented: 

355 return _result 

356 # Add nodes to the TensorFlow graph. 

357 if shared_name is None: 

358 shared_name = "" 

359 shared_name = _execute.make_str(shared_name, "shared_name") 

360 if list_registered_methods is None: 

361 list_registered_methods = False 

362 list_registered_methods = _execute.make_bool(list_registered_methods, "list_registered_methods") 

363 try: 

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

365 "RpcClient", server_address=server_address, 

366 timeout_in_ms=timeout_in_ms, shared_name=shared_name, 

367 list_registered_methods=list_registered_methods, 

368 name=name) 

369 except (TypeError, ValueError): 

370 _result = _dispatch.dispatch( 

371 rpc_client, (), dict(server_address=server_address, 

372 timeout_in_ms=timeout_in_ms, 

373 shared_name=shared_name, 

374 list_registered_methods=list_registered_methods, 

375 name=name) 

376 ) 

377 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED: 

378 return _result 

379 raise 

380 _result = _outputs[:] 

381 if _execute.must_record_gradient(): 

382 _attrs = ("shared_name", _op.get_attr("shared_name"), 

383 "list_registered_methods", 

384 _op._get_attr_bool("list_registered_methods")) 

385 _inputs_flat = _op.inputs 

386 _execute.record_gradient( 

387 "RpcClient", _inputs_flat, _attrs, _result) 

388 _result = _RpcClientOutput._make(_result) 

389 return _result 

390 

391RpcClient = tf_export("raw_ops.RpcClient")(_ops.to_raw_op(rpc_client)) 

392_dispatcher_for_rpc_client = rpc_client._tf_type_based_dispatcher.Dispatch 

393 

394 

395def rpc_client_eager_fallback(server_address, timeout_in_ms, shared_name, list_registered_methods, name, ctx): 

396 if shared_name is None: 

397 shared_name = "" 

398 shared_name = _execute.make_str(shared_name, "shared_name") 

399 if list_registered_methods is None: 

400 list_registered_methods = False 

401 list_registered_methods = _execute.make_bool(list_registered_methods, "list_registered_methods") 

402 server_address = _ops.convert_to_tensor(server_address, _dtypes.string) 

403 timeout_in_ms = _ops.convert_to_tensor(timeout_in_ms, _dtypes.int64) 

404 _inputs_flat = [server_address, timeout_in_ms] 

405 _attrs = ("shared_name", shared_name, "list_registered_methods", 

406 list_registered_methods) 

407 _result = _execute.execute(b"RpcClient", 2, inputs=_inputs_flat, 

408 attrs=_attrs, ctx=ctx, name=name) 

409 if _execute.must_record_gradient(): 

410 _execute.record_gradient( 

411 "RpcClient", _inputs_flat, _attrs, _result) 

412 _result = _RpcClientOutput._make(_result) 

413 return _result 

414 

415 

416@_dispatch.add_fallback_dispatch_list 

417@_dispatch.add_type_based_api_dispatcher 

418@tf_export('rpc_get_value') 

419def rpc_get_value(status_or, Tout, name=None): 

420 r"""TODO: add doc. 

421 

422 Args: 

423 status_or: A `Tensor` of type `resource`. 

424 Tout: A list of `tf.DTypes`. 

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

426 

427 Returns: 

428 A list of `Tensor` objects of type `Tout`. 

429 """ 

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

431 tld = _ctx._thread_local_data 

432 if tld.is_eager: 

433 try: 

434 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

435 _ctx, "RpcGetValue", name, status_or, "Tout", Tout) 

436 return _result 

437 except _core._NotOkStatusException as e: 

438 _ops.raise_from_not_ok_status(e, name) 

439 except _core._FallbackException: 

440 pass 

441 try: 

442 _result = _dispatcher_for_rpc_get_value( 

443 (status_or, Tout, name,), None) 

444 if _result is not NotImplemented: 

445 return _result 

446 return rpc_get_value_eager_fallback( 

447 status_or, Tout=Tout, name=name, ctx=_ctx) 

448 except _core._SymbolicException: 

449 pass # Add nodes to the TensorFlow graph. 

450 except (TypeError, ValueError): 

451 _result = _dispatch.dispatch( 

452 rpc_get_value, (), dict(status_or=status_or, Tout=Tout, name=name) 

453 ) 

454 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED: 

455 return _result 

456 raise 

457 else: 

458 _result = _dispatcher_for_rpc_get_value( 

459 (status_or, Tout, name,), None) 

460 if _result is not NotImplemented: 

461 return _result 

462 # Add nodes to the TensorFlow graph. 

463 if not isinstance(Tout, (list, tuple)): 

464 raise TypeError( 

465 "Expected list for 'Tout' argument to " 

466 "'rpc_get_value' Op, not %r." % Tout) 

467 Tout = [_execute.make_type(_t, "Tout") for _t in Tout] 

468 try: 

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

470 "RpcGetValue", status_or=status_or, Tout=Tout, name=name) 

471 except (TypeError, ValueError): 

472 _result = _dispatch.dispatch( 

473 rpc_get_value, (), dict(status_or=status_or, Tout=Tout, name=name) 

474 ) 

475 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED: 

476 return _result 

477 raise 

478 _result = _outputs[:] 

479 if not _result: 

480 return _op 

481 if _execute.must_record_gradient(): 

482 _attrs = ("Tout", _op.get_attr("Tout")) 

483 _inputs_flat = _op.inputs 

484 _execute.record_gradient( 

485 "RpcGetValue", _inputs_flat, _attrs, _result) 

486 return _result 

487 

488RpcGetValue = tf_export("raw_ops.RpcGetValue")(_ops.to_raw_op(rpc_get_value)) 

489_dispatcher_for_rpc_get_value = rpc_get_value._tf_type_based_dispatcher.Dispatch 

490 

491 

492def rpc_get_value_eager_fallback(status_or, Tout, name, ctx): 

493 if not isinstance(Tout, (list, tuple)): 

494 raise TypeError( 

495 "Expected list for 'Tout' argument to " 

496 "'rpc_get_value' Op, not %r." % Tout) 

497 Tout = [_execute.make_type(_t, "Tout") for _t in Tout] 

498 status_or = _ops.convert_to_tensor(status_or, _dtypes.resource) 

499 _inputs_flat = [status_or] 

500 _attrs = ("Tout", Tout) 

501 _result = _execute.execute(b"RpcGetValue", len(Tout), inputs=_inputs_flat, 

502 attrs=_attrs, ctx=ctx, name=name) 

503 if _execute.must_record_gradient(): 

504 _execute.record_gradient( 

505 "RpcGetValue", _inputs_flat, _attrs, _result) 

506 return _result 

507 

508 

509@_dispatch.add_fallback_dispatch_list 

510@_dispatch.add_type_based_api_dispatcher 

511@tf_export('rpc_server') 

512def rpc_server(server_address, name=None): 

513 r"""TODO: add doc. 

514 

515 Args: 

516 server_address: A `Tensor` of type `string`. 

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

518 

519 Returns: 

520 A `Tensor` of type `resource`. 

521 """ 

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

523 tld = _ctx._thread_local_data 

524 if tld.is_eager: 

525 try: 

526 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

527 _ctx, "RpcServer", name, server_address) 

528 return _result 

529 except _core._NotOkStatusException as e: 

530 _ops.raise_from_not_ok_status(e, name) 

531 except _core._FallbackException: 

532 pass 

533 try: 

534 _result = _dispatcher_for_rpc_server( 

535 (server_address, name,), None) 

536 if _result is not NotImplemented: 

537 return _result 

538 return rpc_server_eager_fallback( 

539 server_address, name=name, ctx=_ctx) 

540 except _core._SymbolicException: 

541 pass # Add nodes to the TensorFlow graph. 

542 except (TypeError, ValueError): 

543 _result = _dispatch.dispatch( 

544 rpc_server, (), dict(server_address=server_address, name=name) 

545 ) 

546 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED: 

547 return _result 

548 raise 

549 else: 

550 _result = _dispatcher_for_rpc_server( 

551 (server_address, name,), None) 

552 if _result is not NotImplemented: 

553 return _result 

554 # Add nodes to the TensorFlow graph. 

555 try: 

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

557 "RpcServer", server_address=server_address, name=name) 

558 except (TypeError, ValueError): 

559 _result = _dispatch.dispatch( 

560 rpc_server, (), dict(server_address=server_address, name=name) 

561 ) 

562 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED: 

563 return _result 

564 raise 

565 _result = _outputs[:] 

566 if _execute.must_record_gradient(): 

567 _attrs = () 

568 _inputs_flat = _op.inputs 

569 _execute.record_gradient( 

570 "RpcServer", _inputs_flat, _attrs, _result) 

571 _result, = _result 

572 return _result 

573 

574RpcServer = tf_export("raw_ops.RpcServer")(_ops.to_raw_op(rpc_server)) 

575_dispatcher_for_rpc_server = rpc_server._tf_type_based_dispatcher.Dispatch 

576 

577 

578def rpc_server_eager_fallback(server_address, name, ctx): 

579 server_address = _ops.convert_to_tensor(server_address, _dtypes.string) 

580 _inputs_flat = [server_address] 

581 _attrs = None 

582 _result = _execute.execute(b"RpcServer", 1, inputs=_inputs_flat, 

583 attrs=_attrs, ctx=ctx, name=name) 

584 if _execute.must_record_gradient(): 

585 _execute.record_gradient( 

586 "RpcServer", _inputs_flat, _attrs, _result) 

587 _result, = _result 

588 return _result 

589 

590 

591@_dispatch.add_fallback_dispatch_list 

592@_dispatch.add_type_based_api_dispatcher 

593@tf_export('rpc_server_register') 

594def rpc_server_register(server, method_name, captured_inputs, f, output_specs, input_specs="", name=None): 

595 r"""TODO: add doc. 

596 

597 Args: 

598 server: A `Tensor` of type `resource`. 

599 method_name: A `Tensor` of type `string`. 

600 captured_inputs: A list of `Tensor` objects. 

601 f: A function decorated with @Defun. 

602 output_specs: A `string`. 

603 input_specs: An optional `string`. Defaults to `""`. 

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

605 

606 Returns: 

607 The created Operation. 

608 """ 

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

610 tld = _ctx._thread_local_data 

611 if tld.is_eager: 

612 try: 

613 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

614 _ctx, "RpcServerRegister", name, server, method_name, captured_inputs, 

615 "f", f, "input_specs", input_specs, "output_specs", output_specs) 

616 return _result 

617 except _core._NotOkStatusException as e: 

618 _ops.raise_from_not_ok_status(e, name) 

619 except _core._FallbackException: 

620 pass 

621 try: 

622 _result = _dispatcher_for_rpc_server_register( 

623 (server, method_name, captured_inputs, f, output_specs, input_specs, 

624 name,), None) 

625 if _result is not NotImplemented: 

626 return _result 

627 return rpc_server_register_eager_fallback( 

628 server, method_name, captured_inputs, f=f, input_specs=input_specs, 

629 output_specs=output_specs, name=name, ctx=_ctx) 

630 except _core._SymbolicException: 

631 pass # Add nodes to the TensorFlow graph. 

632 except (TypeError, ValueError): 

633 _result = _dispatch.dispatch( 

634 rpc_server_register, (), dict(server=server, 

635 method_name=method_name, 

636 captured_inputs=captured_inputs, 

637 f=f, output_specs=output_specs, 

638 input_specs=input_specs, name=name) 

639 ) 

640 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED: 

641 return _result 

642 raise 

643 else: 

644 _result = _dispatcher_for_rpc_server_register( 

645 (server, method_name, captured_inputs, f, output_specs, input_specs, 

646 name,), None) 

647 if _result is not NotImplemented: 

648 return _result 

649 # Add nodes to the TensorFlow graph. 

650 output_specs = _execute.make_str(output_specs, "output_specs") 

651 if input_specs is None: 

652 input_specs = "" 

653 input_specs = _execute.make_str(input_specs, "input_specs") 

654 try: 

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

656 "RpcServerRegister", server=server, method_name=method_name, 

657 captured_inputs=captured_inputs, f=f, 

658 output_specs=output_specs, 

659 input_specs=input_specs, name=name) 

660 except (TypeError, ValueError): 

661 _result = _dispatch.dispatch( 

662 rpc_server_register, (), dict(server=server, 

663 method_name=method_name, 

664 captured_inputs=captured_inputs, f=f, 

665 output_specs=output_specs, 

666 input_specs=input_specs, name=name) 

667 ) 

668 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED: 

669 return _result 

670 raise 

671 return _op 

672RpcServerRegister = tf_export("raw_ops.RpcServerRegister")(_ops.to_raw_op(rpc_server_register)) 

673_dispatcher_for_rpc_server_register = rpc_server_register._tf_type_based_dispatcher.Dispatch 

674 

675 

676def rpc_server_register_eager_fallback(server, method_name, captured_inputs, f, output_specs, input_specs, name, ctx): 

677 output_specs = _execute.make_str(output_specs, "output_specs") 

678 if input_specs is None: 

679 input_specs = "" 

680 input_specs = _execute.make_str(input_specs, "input_specs") 

681 _attr_Tin, captured_inputs = _execute.convert_to_mixed_eager_tensors(captured_inputs, ctx) 

682 server = _ops.convert_to_tensor(server, _dtypes.resource) 

683 method_name = _ops.convert_to_tensor(method_name, _dtypes.string) 

684 _inputs_flat = [server, method_name] + list(captured_inputs) 

685 _attrs = ("Tin", _attr_Tin, "f", f, "input_specs", input_specs, 

686 "output_specs", output_specs) 

687 _result = _execute.execute(b"RpcServerRegister", 0, inputs=_inputs_flat, 

688 attrs=_attrs, ctx=ctx, name=name) 

689 _result = None 

690 return _result 

691 

692 

693@_dispatch.add_fallback_dispatch_list 

694@_dispatch.add_type_based_api_dispatcher 

695@tf_export('rpc_server_start') 

696def rpc_server_start(server, name=None): 

697 r"""TODO: add doc. 

698 

699 Args: 

700 server: A `Tensor` of type `resource`. 

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

702 

703 Returns: 

704 The created Operation. 

705 """ 

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

707 tld = _ctx._thread_local_data 

708 if tld.is_eager: 

709 try: 

710 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

711 _ctx, "RpcServerStart", name, server) 

712 return _result 

713 except _core._NotOkStatusException as e: 

714 _ops.raise_from_not_ok_status(e, name) 

715 except _core._FallbackException: 

716 pass 

717 try: 

718 _result = _dispatcher_for_rpc_server_start( 

719 (server, name,), None) 

720 if _result is not NotImplemented: 

721 return _result 

722 return rpc_server_start_eager_fallback( 

723 server, name=name, ctx=_ctx) 

724 except _core._SymbolicException: 

725 pass # Add nodes to the TensorFlow graph. 

726 except (TypeError, ValueError): 

727 _result = _dispatch.dispatch( 

728 rpc_server_start, (), dict(server=server, name=name) 

729 ) 

730 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED: 

731 return _result 

732 raise 

733 else: 

734 _result = _dispatcher_for_rpc_server_start( 

735 (server, name,), None) 

736 if _result is not NotImplemented: 

737 return _result 

738 # Add nodes to the TensorFlow graph. 

739 try: 

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

741 "RpcServerStart", server=server, name=name) 

742 except (TypeError, ValueError): 

743 _result = _dispatch.dispatch( 

744 rpc_server_start, (), dict(server=server, name=name) 

745 ) 

746 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED: 

747 return _result 

748 raise 

749 return _op 

750RpcServerStart = tf_export("raw_ops.RpcServerStart")(_ops.to_raw_op(rpc_server_start)) 

751_dispatcher_for_rpc_server_start = rpc_server_start._tf_type_based_dispatcher.Dispatch 

752 

753 

754def rpc_server_start_eager_fallback(server, name, ctx): 

755 server = _ops.convert_to_tensor(server, _dtypes.resource) 

756 _inputs_flat = [server] 

757 _attrs = None 

758 _result = _execute.execute(b"RpcServerStart", 0, inputs=_inputs_flat, 

759 attrs=_attrs, ctx=ctx, name=name) 

760 _result = None 

761 return _result 

762