Returns the current TowerContext or None if in a cross-tower context.
Note that execution:
1. starts in the default (single-tower) tower context (this function
will return the default TowerContext object);
2. switches to cross-tower context (in which case this will return
None) when entering a
with DistributionStrategy.scope(): block;
3. switches to a (non-default) tower context inside
get_tower_context()->merge_call(merge_fn, ...), then
merge_fn you are back in the cross-tower context (and again
this function will return None).
Note that you can also go directly from step 1 to 4 to switch to a
cross-tower context for the default
DistributionStrategy. You may
also switch from the cross-tower context of 4 to a tower context by
call_for_each_tower(), jumping back to step 3.
DistributionStrategy methods may only be executed in
a cross-tower context, in a tower context you should use the
TowerContext API instead.
TowerContext object when in a tower context scope, else None.
Exactly one of
will return None in a particular block.