MCPcopy Create free account
hub / github.com/AIS-SNU/Smart-Infinity / float_conversion

Function float_conversion

DeepSpeedExample/megatron/model/module.py:142–148  ·  view source on GitHub ↗
(val)

Source from the content-addressed store, hash-verified

140def float16_to_fp32(val):
141 """Convert fp16/bf16 `val` to fp32"""
142 def float_conversion(val):
143 val_typecheck = val
144 if isinstance(val_typecheck, (Parameter, Variable)):
145 val_typecheck = val.data
146 if isinstance(val_typecheck, (_BF16_TYPES, _HALF_TYPES)):
147 val = val.float()
148 return val
149 return conversion_helper(val, float_conversion)
150
151

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected