I want to optimize a model but I meet the error:
Traceback (most recent call last):
  File "mobile_test.py", line 129, in <module>
    data_loader,bn_list[0],net_config))
  File "mobile_test.py", line 62, in prepare_subnet
    script_subnet = torch.jit.script(subnet)
  File "/home/yuantian/.local/lib/python3.6/site-packages/torch/jit/_script.py", line 943, in script
    obj, torch.jit._recursive.infer_methods_to_compile
  File "/home/yuantian/.local/lib/python3.6/site-packages/torch/jit/_recursive.py", line 391, in create_script_module
    return create_script_module_impl(nn_module, concrete_type, stubs_fn)
  File "/home/yuantian/.local/lib/python3.6/site-packages/torch/jit/_recursive.py", line 448, in create_script_module_impl
    script_module = torch.jit.RecursiveScriptModule._construct(cpp_module, init_fn)
  File "/home/yuantian/.local/lib/python3.6/site-packages/torch/jit/_script.py", line 391, in _construct
    init_fn(script_module)
  File "/home/yuantian/.local/lib/python3.6/site-packages/torch/jit/_recursive.py", line 428, in init_fn
    scripted = create_script_module_impl(orig_value, sub_concrete_type, stubs_fn)
  File "/home/yuantian/.local/lib/python3.6/site-packages/torch/jit/_recursive.py", line 404, in create_script_module_impl
    property_stubs = get_property_stubs(nn_module)
  File "/home/yuantian/.local/lib/python3.6/site-packages/torch/jit/_recursive.py", line 697, in get_property_stubs
    properties_asts = get_class_properties(module_ty, self_name="RecursiveScriptModule")
  File "/home/yuantian/.local/lib/python3.6/site-packages/torch/jit/frontend.py", line 153, in get_class_properties
    getter = get_jit_def(prop[1].fget, f"__{prop[0]}_getter", self_name=self_name)
  File "/home/yuantian/.local/lib/python3.6/site-packages/torch/jit/frontend.py", line 271, in get_jit_def
    return build_def(ctx, fn_def, type_line, def_name, self_name=self_name)
  File "/home/yuantian/.local/lib/python3.6/site-packages/torch/jit/frontend.py", line 305, in build_def
    build_stmts(ctx, body))
  File "/home/yuantian/.local/lib/python3.6/site-packages/torch/jit/frontend.py", line 129, in build_stmts
    stmts = [build_stmt(ctx, s) for s in stmts]
  File "/home/yuantian/.local/lib/python3.6/site-packages/torch/jit/frontend.py", line 129, in <listcomp>
    stmts = [build_stmt(ctx, s) for s in stmts]
  File "/home/yuantian/.local/lib/python3.6/site-packages/torch/jit/frontend.py", line 279, in __call__
    return method(ctx, node)
  File "/home/yuantian/.local/lib/python3.6/site-packages/torch/jit/frontend.py", line 445, in build_Return
    return Return(r, None if stmt.value is None else build_expr(ctx, stmt.value))
  File "/home/yuantian/.local/lib/python3.6/site-packages/torch/jit/frontend.py", line 279, in __call__
    return method(ctx, node)
  File "/home/yuantian/.local/lib/python3.6/site-packages/torch/jit/frontend.py", line 781, in build_Dict
    return DictLiteral(range, [build_expr(ctx, e) for e in expr.keys],
  File "/home/yuantian/.local/lib/python3.6/site-packages/torch/jit/frontend.py", line 781, in <listcomp>
    return DictLiteral(range, [build_expr(ctx, e) for e in expr.keys],
  File "/home/yuantian/.local/lib/python3.6/site-packages/torch/jit/frontend.py", line 278, in __call__
    raise UnsupportedNodeError(ctx, node)
  File "/home/yuantian/.local/lib/python3.6/site-packages/torch/jit/frontend.py", line 111, in __init__
    source_range = ctx.make_range(offending_node.lineno,
AttributeError: 'NoneType' object has no attribute 'lineno'

And this is my code link:
https://drive.google.com/drive/folders/172QoQxYoB1fUPvwjudHWgBmRv-IfE8Mg?usp=sharing 1
You can run the test1 file to see the error.
I have located the error in source code:

839b4d67e2751d1132bdbb066b775c9713×71 34 KB


But we do not know how to solve it.
Kind regards.