我正在尝试可视化我为预测分子属性而制作的 Graph Neural Networks 的计算图。该模型是在 PyTorch 中制作的,并将 DGL 图作为输入。尝试可视化模型的代码片段如下所示:
train_log_dir = f'logs/{datetime.datetime.now().strftime("%Y%m%d-%H%M%S")}/train'
train_summary_writer = tensorboardX.SummaryWriter(train_log_dir)
train_summary_writer.add_graph(model, [transformer(dataset[0][0]), transformer(dataset[0][0])])
我遇到以下错误,TensorBoardX 无法可视化图形模型,拒绝接受 DGL 图作为输入,只需要张量。有什么方法可以可视化模型吗?
RuntimeError: Tracer cannot infer type of (Graph(num_nodes=3, num_edges=4,
ndata_schemes={'x': Scheme(shape=(10,), dtype=torch.float32)}
edata_schemes={'w': Scheme(shape=(4,), dtype=torch.float32)}), Graph(num_nodes=3, num_edges=4,
ndata_schemes={'x': Scheme(shape=(10,), dtype=torch.float32)}
edata_schemes={'w': Scheme(shape=(4,), dtype=torch.float32)}))
:Only tensors and (possibly nested) tuples of tensors, lists, or dictsare supported as inputs or outputs of traced functions, but instead got value of type DGLHeteroGraph.
Process finished with exit code 1