(arg_type, kind, real_type, arg_N)
| 6198 | return new torch.Argument(name, fake_type, real_type, N, default_value, kwarg_only, alias_info); |
| 6199 | } |
| 6200 | parseDefaultValue(arg_type, kind, real_type, arg_N) { |
| 6201 | // auto range = L.cur().range; |
| 6202 | const L = this.L; |
| 6203 | const range = null; |
| 6204 | switch (kind) { |
| 6205 | |
| 6206 | case torch._C.TypeKind.StringType: |
| 6207 | case torch._C.TypeKind.OptionalType: |
| 6208 | case torch._C.TypeKind.NumberType: |
| 6209 | case torch._C.TypeKind.IntType: |
| 6210 | case torch._C.TypeKind.BoolType: |
| 6211 | case torch._C.TypeKind.FloatType: |
| 6212 | case torch._C.TypeKind.ComplexType: |
| 6213 | return this.parseSingleConstant(arg_type, kind, real_type); |
| 6214 | case torch._C.TypeKind.ListType: { |
| 6215 | const elem_type = arg_type.containedType(0); |
| 6216 | const real_elem_type = real_type.containedType(0); |
| 6217 | if (L.cur().kind === 'id') { |
| 6218 | return this.parseTensorDefault(range); |
| 6219 | } else if (arg_N && L.cur().kind !== '[') { |
| 6220 | const v = this.parseSingleConstant(elem_type, elem_type.kind(), real_elem_type); |
| 6221 | const repeated = Array(arg_N).fill(v); |
| 6222 | // std::vector<IValue> repeated(arg_N, v); |
| 6223 | return this.convertToList(elem_type, elem_type.kind(), range, repeated); |
| 6224 | } |
| 6225 | return this.parseConstantList(elem_type, elem_type.kind(), real_elem_type); |
| 6226 | } |
| 6227 | case torch._C.TypeKind.DynamicType: |
| 6228 | return this.parseDefaultValue(arg_type, arg_type.dynamicKind(), real_type, arg_N); |
| 6229 | default: |
| 6230 | throw new python.Error(`Unsupported default value kind '${kind}'.`); |
| 6231 | } |
| 6232 | } |
| 6233 | parseSingleConstant(type, kind, real_type) { |
| 6234 | const L = this.L; |
| 6235 | if (kind === torch._C.TypeKind.DynamicType) { |
no test coverage detected