This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS: i run the train code. get an error as follow about hooks

Tool/software: Code Composer Studio

Traceback (most recent call last):
  File "./scripts/train_segmentation_main.py", line 143, in <module>
    train_pixel2pixel.main(args)
  File "/home/data/erfnet-pytorch/pytorch-jacinto-ai-devkit/modules/pytorch_jacinto_ai/engine/train_pixel2pixel.py", line 346, in main
    count_flops(args, model)
  File "/home/data/erfnet-pytorch/pytorch-jacinto-ai-devkit/modules/pytorch_jacinto_ai/engine/train_pixel2pixel.py", line 824, in count_flops
    flops = xnn.utils.forward_count_flops(model, dummy_input)
  File "/home/data/erfnet-pytorch/pytorch-jacinto-ai-devkit/modules/pytorch_jacinto_ai/xnn/utils/count_flops.py", line 6, in forward_count_flops
    _ = module(inp)
  File "/usr/local/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/data/erfnet-pytorch/pytorch-jacinto-ai-devkit/modules/pytorch_jacinto_ai/xnn/quantize/quant_train_module.py", line 60, in forward
    self.analyze_graph(inputs=inputs, cleanup_states=True)
  File "/home/data/erfnet-pytorch/pytorch-jacinto-ai-devkit/modules/pytorch_jacinto_ai/xnn/quantize/quant_graph_module.py", line 96, in analyze_graph
    self.forward_analyze_modules(inputs)
  File "/home/data/erfnet-pytorch/pytorch-jacinto-ai-devkit/modules/pytorch_jacinto_ai/xnn/quantize/quant_graph_module.py", line 171, in forward_analyze_modules
    output = self.module(inputs)
  File "/usr/local/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/data/erfnet-pytorch/pytorch-jacinto-ai-devkit/modules/pytorch_jacinto_ai/vision/models/pixel2pixel/pixel2pixelnet.py", line 102, in forward
    x_features, x_list = self.encoder(x_list)
  File "/usr/local/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/data/erfnet-pytorch/pytorch-jacinto-ai-devkit/modules/pytorch_jacinto_ai/xnn/quantize/quant_graph_module.py", line 180, in _analyze_modules_op
    outputs = op.__forward_orig__(*inputs_orig)
  File "/home/data/erfnet-pytorch/pytorch-jacinto-ai-devkit/modules/pytorch_jacinto_ai/vision/models/multi_input_net.py", line 99, in forward
    x = block(x)
  File "/usr/local/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/data/erfnet-pytorch/pytorch-jacinto-ai-devkit/modules/pytorch_jacinto_ai/xnn/quantize/quant_graph_module.py", line 180, in _analyze_modules_op
    outputs = op.__forward_orig__(*inputs_orig)
  File "/usr/local/anaconda3/lib/python3.6/site-packages/torch/nn/modules/container.py", line 92, in forward
    input = module(input)
  File "/usr/local/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 499, in __call__
    "didn't return None".format(hook))
RuntimeError: forward hooks should never return any values, but '<function QuantTrainModule.model_surgery_quantize.<locals>._forward_activation at 0x7fb5dddf5c80>'didn't return None

  • Hi,

    You seem to be using an old version of PyTorch. The recent versions of PyTorch does not produce this error. Please update to a recent version. I have used 1.3.1 and 1.4.0.

    Note: I din't think this question is about CCS / Code Composer Studio - its a wrong tag and subject.

    Best regards,