MCPcopy
hub / github.com/lutzroeder/netron / isSubtypeOf

Method isSubtypeOf

source/python.js:10394–10408  ·  view source on GitHub ↗
(rhs)

Source from the content-addressed store, hash-verified

10392 return this.kind() === rhs.kind();
10393 }
10394 isSubtypeOf(rhs) {
10395 if (rhs.kind() === 'AnyType' || this === rhs) {
10396 return true;
10397 }
10398 if (rhs instanceof torch.OptionalType && this instanceof torch.OptionalType === false) {
10399 return this.isSubtypeOf(rhs.getElementType());
10400 }
10401 if (rhs instanceof torch.UnionType) {
10402 return rhs.containedTypes().some((inner) => this.isSubtypeOf(inner));
10403 }
10404 if (rhs instanceof torch._C.DynamicType) {
10405 return torch._C.DynamicType.create(this).isSubtypeOf(rhs);
10406 }
10407 return this.equals(rhs);
10408 }
10409 containedTypes() {
10410 return [];
10411 }

Callers 15

constructorMethod · 0.80
optimizeBlockMethod · 0.80
unshapedTypeMethod · 0.80
createWithContainedMethod · 0.80
should_subtractMethod · 0.80
createListMethod · 0.80
createDictMethod · 0.80
matchesMethod · 0.80
setSugaredVarMethod · 0.80
attrMethod · 0.80
setAttrMethod · 0.80
getitemMethod · 0.80

Calls 8

getElementTypeMethod · 0.80
containedTypesMethod · 0.80
kindMethod · 0.45
createMethod · 0.45
equalsMethod · 0.45
pushMethod · 0.45
getMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected