Open leilaShen opened 3 years ago
对了 我trace的时候 因为报错 所以加了 strict=false的选项 当时报错内容如下:
RuntimeError: Encountering a dict at the output of the tracer might cause the trace to be incorrect, this is only valid if the container structure does not change based on the module's inputs. Consider using a constant container instead (e.g. for list
, use a tuple
instead. for dict
, use a NamedTuple
instead). If you absolutely need this and know the side effects, pass strict=False to trace() to allow this behavior.
trace 段的代码如下: example = torch.ones(1,3,512,512).cuda() traced_script_module = torch.jit.trace(self.model, example) #, strict=False) temp = traced_script_module(torch.ones(1,3,512,512).cuda()) torch.jit.save(traced_script_module, "/home/dell/piou/models/model_dla_dcn_0302_2.pt")
有什么办法能确认用trace script工具生成的pt模型 和python的pth模型是一致的吗 我现在转完模型后 发现在c++中forward的结果 和python 不一致
已经确认了输入是相同的