2121from tensorflow .python .distribute import device_util
2222from tensorflow .python .distribute import distribute_lib
2323from tensorflow .python .distribute import distribute_utils
24+ from tensorflow .python .distribute import numpy_dataset
2425from tensorflow .python .distribute import reduce_util
2526from tensorflow .python .distribute import values
2627from tensorflow .python .framework import device as device_lib
3435from tensorflow .python .ops import variable_scope
3536from tensorflow .python .training import server_lib
3637from tensorflow .python .training .tracking import base as trackable
37- from tensorflow .python .util import tf_contextlib
3838from tensorflow .python .ipu .horovod import Sum , Average , \
3939 allreduce as hvd_allreduce , \
4040 broadcast as hvd_broadcast
@@ -106,25 +106,6 @@ def supports_loss_scaling(self):
106106 return True
107107
108108
109- def _is_inside_compilation ():
110- graph = ops .get_default_graph ()
111- attrs = graph ._attr_scope_map # pylint: disable=protected-access
112-
113- is_in_xla_context = control_flow_util .GraphOrParentsInXlaContext (graph )
114- is_outside_compilation = scopes .OUTSIDE_COMPILATION_NAME in attrs
115-
116- return is_in_xla_context and not is_outside_compilation
117-
118-
119- @tf_contextlib .contextmanager
120- def _outside_compilation_scope_if_needed (name ):
121- if _is_inside_compilation ():
122- with scopes .outside_compilation_scope (name ):
123- yield
124- else :
125- yield
126-
127-
128109def _ipu_device_for_host (ipu_device_string , host_device_string ):
129110 ipu_device = device_lib .DeviceSpec .from_string (ipu_device_string )
130111 host_device = device_lib .DeviceSpec .from_string (host_device_string )
@@ -139,11 +120,6 @@ def _ipu_device_for_host(ipu_device_string, host_device_string):
139120 return ipu_for_host .to_string ()
140121
141122
142- def _make_identity_op (v ):
143- name = v .name .replace (":" , "_" )
144- return array_ops .identity (v , name = name )
145-
146-
147123class IPUDistributedVariable (values .DistributedVariable ): # pylint: disable=abstract-method
148124 pass
149125
0 commit comments