雾聪
2024-03-14 0cf5dfec2c8313fc2ed2aab8d10bf3dc4b9c283f
funasr/utils/misc.py
@@ -12,7 +12,7 @@
    return numel
def int2vec(x, vec_dim=8, dtype=np.int):
def int2vec(x, vec_dim=8, dtype=np.int32):
    b = ('{:0' + str(vec_dim) + 'b}').format(x)
    # little-endian order: lower bit first
    return (np.array(list(b)[::-1]) == '1').astype(dtype)
@@ -46,3 +46,10 @@
                value = value.split(' ')
            ret_dict.append((key, value))
        return ret_dict
def deep_update(original, update):
    for key, value in update.items():
        if isinstance(value, dict) and key in original:
            deep_update(original[key], value)
        else:
            original[key] = value