MCPcopy Index your code
hub / github.com/lutzroeder/netron / parseBaseTypeName

Method parseBaseTypeName

source/python.js:11949–11963  ·  view source on GitHub ↗
(expr)

Source from the content-addressed store, hash-verified

11947 throw new python.Error(`Unknown type name '${name}'.`);
11948 }
11949 parseBaseTypeName(expr) {
11950 if (expr instanceof ast.Name) {
11951 return expr.id;
11952 } else if (expr instanceof ast.Constant && expr.value === null) {
11953 return 'None';
11954 } else if (expr instanceof ast.Attribute) {
11955 const name = expr.attr;
11956 const tensor_subtypes = new Set(['Tensor', 'LongTensor', 'FloatTensor', 'DoubleTensor', 'IntTensor', 'ShortTensor', 'HalfTensor', 'CharTensor', 'ByteTensor', 'BoolTensor']);
11957 if (torch._C.isTorch(expr.value) && tensor_subtypes.has(name)) {
11958 return name;
11959 }
11960 return torch._C.collectQualname(expr);
11961 }
11962 throw new python.Error(`Unsupported type '${expr.__class__.__name__}'.`);
11963 }
11964 parseBroadcastList(/* expr */) {
11965 return null;
11966 }

Callers 1

parseTypeFromExprImplMethod · 0.80

Calls 1

hasMethod · 0.45

Tested by

no test coverage detected