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

Function maybe_set

codegeex/megatron/mpu/layers.py:66–68  ·  view source on GitHub ↗
(attribute, value)

Source from the content-addressed store, hash-verified

64
65def set_defaults_if_not_set_tensor_model_parallel_attributes(tensor):
66 def maybe_set(attribute, value):
67 if not hasattr(tensor, attribute):
68 setattr(tensor, attribute, value)
69
70 for attribute in _MODEL_PARALLEL_ATTRIBUTE_DEFAULTS:
71 maybe_set(attribute, _MODEL_PARALLEL_ATTRIBUTE_DEFAULTS[attribute])

Calls

no outgoing calls

Tested by

no test coverage detected