(to_subtract, from)
| 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 | } |
no test coverage detected