MCPcopy Create free account
hub / github.com/zai-org/CodeGeeX / maybe_copy

Function maybe_copy

codegeex/megatron/mpu/layers.py:75–77  ·  view source on GitHub ↗
(attribute)

Source from the content-addressed store, hash-verified

73
74def copy_tensor_model_parallel_attributes(destination_tensor, source_tensor):
75 def maybe_copy(attribute):
76 if hasattr(source_tensor, attribute):
77 setattr(destination_tensor, attribute, getattr(source_tensor, attribute))
78
79 for attribute in _MODEL_PARALLEL_ATTRIBUTE_DEFAULTS:
80 maybe_copy(attribute)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected