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

38 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 sync_device(name=None): 

25 r"""Synchronizes the device this op is run on. 

26 

27 Only GPU ops are asynchrous in TensorFlow, and so this only has an effect when 

28 run on GPUs. On GPUs, this op synchronizes the GPU's compute stream. 

29 

30 Args: 

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

32 

33 Returns: 

34 The created Operation. 

35 """ 

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

37 tld = _ctx._thread_local_data 

38 if tld.is_eager: 

39 try: 

40 _result = pywrap_tfe.TFE_Py_FastPathExecute( 

41 _ctx, "SyncDevice", name) 

42 return _result 

43 except _core._NotOkStatusException as e: 

44 _ops.raise_from_not_ok_status(e, name) 

45 except _core._FallbackException: 

46 pass 

47 try: 

48 return sync_device_eager_fallback( 

49 name=name, ctx=_ctx) 

50 except _core._SymbolicException: 

51 pass # Add nodes to the TensorFlow graph. 

52 # Add nodes to the TensorFlow graph. 

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

54 "SyncDevice", name=name) 

55 return _op 

56SyncDevice = tf_export("raw_ops.SyncDevice")(_ops.to_raw_op(sync_device)) 

57 

58 

59def sync_device_eager_fallback(name, ctx): 

60 _inputs_flat = [] 

61 _attrs = None 

62 _result = _execute.execute(b"SyncDevice", 0, inputs=_inputs_flat, 

63 attrs=_attrs, ctx=ctx, name=name) 

64 _result = None 

65 return _result 

66