AllentDan / LibtorchTutorials

This is a code repository for pytorch c++ (or libtorch) tutorial.
Apache License 2.0
742 stars 122 forks source link

请问jit转换格式的时候 总是报错 请问怎么办? #2

Closed henbucuoshanghai closed 3 years ago

henbucuoshanghai commented 3 years ago

trace 或script的时候? pytorch官网下面有一样的报错,但是无准确 准确解答。 请问怎么办

AllentDan commented 3 years ago

不太明白?你是写了个动态图?在forward时候if判断了? 能否贴个错误

henbucuoshanghai commented 3 years ago

你好 热心的回复 能留邮箱吗 我是1119006913@qq

henbucuoshanghai commented 3 years ago

site-packages/torch/jit/_recursive.py", line 292, in create_methods_from_stubs concrete_type._create_methods(defs, rcbs, defaults) RuntimeError:

forward(torch.model.VGG.VGG16_FPN.FPN self, Tensor inputs) -> ((Tensor, Tensor, Tensor)): Expected a value of type 'Tensor (inferred)' for argument 'inputs' but instead found type 'List[Tensor]'. Inferred 'inputs' to be of type 'Tensor' because it was not annotated with an explicit type. Empty lists default to List[Tensor]. Add a variable annotation to the assignment to create an empty list of another type (torch.jit.annotate(List[T, []]) where T is the type of elements in the list for Python 2)

AllentDan commented 3 years ago

trace可能用tuple要比list好,你改成tuple传输就好了应该 加你QQ了,发现以前加过你创建的群,缘分呐

fanqingyu0604 commented 3 years ago

@AllentDan 请问建立的技术讨论群号是多少