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

Method subtractTypeSetFrom

source/python.js:10900–10914  ·  view source on GitHub ↗
(to_subtract, from)

Source from the content-addressed store, hash-verified

10898 return torch.OptionalType.create(contained_types[0]);
10899 }
10900 subtractTypeSetFrom(to_subtract, from) {
10901 const types = [];
10902 const should_subtract = (lhs) => to_subtract.some((rhs) => lhs.isSubtypeOf(rhs));
10903 for (const t of from) {
10904 if (!should_subtract(t)) {
10905 types.push(t);
10906 }
10907 }
10908 if (types.length === 0) {
10909 return null;
10910 } else if (types.length === 1) {
10911 return types[0];
10912 }
10913 return torch.UnionType.create(types);
10914 }
10915 str() {
10916 return `${this.getElementType().str()}?`;
10917 }

Callers 1

constructorMethod · 0.80

Calls 2

pushMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected