File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 2828
2929# pylint: disable=g-direct-tensorflow-import
3030from tensorflow .compiler .tf2xla .python import xla
31- from tensorflow .compiler .xla .experimental .xla_sharding import xla_sharding
31+ # pylint: disable=g-import-not-at-top
32+ try :
33+ from tensorflow .python .compiler .xla .experimental import xla_sharding
34+ except ImportError :
35+ # OSS backward compatibility, can be removed when TF is updated.
36+ from tensorflow .compiler .xla .experimental .xla_sharding import xla_sharding
3237# pylint: enable=g-direct-tensorflow-import
3338
3439Split = gshard_utils .Split
Original file line number Diff line number Diff line change 2525import sentencepiece as sentencepiece_processor
2626# pylint: disable=g-direct-tensorflow-import
2727from tensorflow .compiler .xla import xla_data_pb2
28- from tensorflow .compiler .xla .experimental .xla_sharding import xla_sharding
28+ # pylint: disable=g-import-not-at-top
29+ try :
30+ from tensorflow .python .compiler .xla .experimental import xla_sharding
31+ except ImportError :
32+ # OSS backward compatibility, can be removed when TF is updated.
33+ from tensorflow .compiler .xla .experimental .xla_sharding import xla_sharding
2934# pylint: enable=g-direct-tensorflow-import
3035
3136ThreadLocalStack = thread_local_utils .ThreadLocalStack
Original file line number Diff line number Diff line change 2222from lingvo import compat as tf
2323
2424# pylint: disable=g-direct-tensorflow-import
25- from tensorflow .compiler .xla .experimental .xla_sharding import xla_sharding
25+ # pylint: disable=g-import-not-at-top
26+ try :
27+ from tensorflow .python .compiler .xla .experimental import xla_sharding
28+ except ImportError :
29+ # OSS backward compatibility, can be removed when TF is updated.
30+ from tensorflow .compiler .xla .experimental .xla_sharding import xla_sharding
2631# pylint: enable=g-direct-tensorflow-import
2732
2833
You can’t perform that action at this time.
0 commit comments