我想打印(在训练之前)模型的状态:使用 print(state['model']),我发现了这个错误:
TypeError: 'ServerState' object is not subscriptable
我想打印(在训练之前)模型的状态:使用 print(state['model']),我发现了这个错误:
TypeError: 'ServerState' object is not subscriptable
tff.leraning.framework.ServerState是一个 Python attrs 类,通过Instance.method( __getattr_) 语法而不是Instance['key']查找 ( __getitem__) 访问 whos 字段。
尝试替换print(state['model'])为print(state.model).