Make device, colocation and dependencies stacks thread-local. Device, colocation and dependencies stacks are not thread-local be default. If multiple threads access them, then the state is shared. This means that one thread may affect the behavior of another thread. After this met
(self)
| 4962 | return tensor_or_op not in self._unfetchable_ops |
| 4963 | |
| 4964 | def switch_to_thread_local(self): |
| 4965 | """Make device, colocation and dependencies stacks thread-local. |
| 4966 | |
| 4967 | Device, colocation and dependencies stacks are not thread-local be default. |
| 4968 | If multiple threads access them, then the state is shared. This means that |
| 4969 | one thread may affect the behavior of another thread. |
| 4970 | |
| 4971 | After this method is called, the stacks become thread-local. If multiple |
| 4972 | threads access them, then the state is not shared. Each thread uses its own |
| 4973 | value; a thread doesn't affect other threads by mutating such a stack. |
| 4974 | |
| 4975 | The initial value for every thread's stack is set to the current value |
| 4976 | of the stack when `switch_to_thread_local()` was first called. |
| 4977 | """ |
| 4978 | if not self._stack_state_is_thread_local: |
| 4979 | self._stack_state_is_thread_local = True |
| 4980 | |
| 4981 | @property |
| 4982 | def _device_function_stack(self): |
no outgoing calls