lidq92 / WaDIQaM

[unofficial] Pytorch implementation of WaDIQaM in TIP2018, Bosse S. et al. (Deep neural networks for no-reference and full-reference image quality assessment)
128 stars 37 forks source link

Failed to save model graph #3

Closed xiaofof closed 5 years ago

xiaofof commented 5 years ago
def create_summary_writer(model, data_loader, log_dir='tensorboard_logs'):
    """ Create Summary Writer for TensorBoard Visualization
    :param model: model
    :param data_loader: data loader
    :param log_dir: log dir
    :return: writer
    """
    writer = SummaryWriter(log_dir=log_dir)
    data_loader_iter = iter(data_loader)
    x, y = next(data_loader_iter)
    try:
        writer.add_graph(model, x) # exception here
    except Exception as e:
        print("Failed to save model graph: {}".format(e))
    return writer

Error: Failed to save model graph: %33 : Tensor = onnx::Unsqueezeaxes=[0] has empty scope name

Could you help me ? my version is torch 1.1.0 torchfile 0.1.0 torchnet 0.0.4 torchvision 0.3.0

lidq92 commented 5 years ago

It does not matter for your training. You can comment the following codes out.

    data_loader_iter = iter(data_loader)
    x, y = next(data_loader_iter)
    try:
        writer.add_graph(model, x) # exception here
    except Exception as e:
        print("Failed to save model graph: {}".format(e))
    return writer

There is some uncommon operations in the model definition, so this error occurs. But it is unnecessary for your training to see the model graph.