megatron.core.utils.safely_set_viewless_tensor_data#
- megatron.core.utils.safely_set_viewless_tensor_data(tensor, new_data_tensor)#
Safely set tensor’s ‘.data’ field.
Check first that the tensor is viewless (i.e., ‘._base’ not set). If not, raise an exception.