/
vuron
/
adept
Обзор
Документация
Войти
/
vuron
/
adept
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
with_cpu
gdb/pprint.py
34 строки
843 B
kolkir
Adam optimizer implementation
01 мар 2025, 17:03
01 мар 2025, 17:03
2fcc751
Код
Авторство
О чём код?
import gdb class AdeptPrinter(gdb.ValuePrinter): def __init__(self, val): self.val = val def to_string(self): if self.val is None: return "undefined" eval_string = ( f"(({self.val.type.name}*){self.val.address})->to_string().c_str()" ) return gdb.parse_and_eval(eval_string).string() def display_hint(self): return "Variable" def adept_lookup_func(val): if str(val.type) == "adept::Variable": return AdeptPrinter(val) if str(val.type) == "const adept::Variable": return AdeptPrinter(val) if str(val.type) == "adept::Tensor": return AdeptPrinter(val) if str(val.type) == "const adept::Tensor": return AdeptPrinter(val) # else: # print(val.type) gdb.pretty_printers.append(adept_lookup_func)