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

Method addIfLoadStores

source/python.js:18228–18251  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

18226 n.addInput(inp);
18227 }
18228 addIfLoadStores(n) {
18229 const [true_block, false_block] = n.blocks();
18230 const true_vars = this.addControlFlowLoadStores(true_block);
18231 const false_vars = this.addControlFlowLoadStores(false_block);
18232 const mutated_variables = new Set();
18233 for (const v of true_vars.definedVariables()) {
18234 if (false_vars.findInAnyFrame(v)) {
18235 mutated_variables.add(v);
18236 }
18237 }
18238 for (const v of false_vars.definedVariables()) {
18239 if (true_vars.findInAnyFrame(v)) {
18240 mutated_variables.add(v);
18241 }
18242 }
18243 for (const x of mutated_variables) {
18244 const true_type = true_vars.findInAnyFrame(x);
18245 const false_type = false_vars.findInAnyFrame(x);
18246 const unified = torch._C.unifyTypes(true_type, false_type, /*default_to_union=*/true);
18247 this.addBlockOutput(true_block, true_type, x);
18248 this.addBlockOutput(false_block, false_type, x);
18249 this.addNodeOutput(n, unified, x);
18250 }
18251 }
18252 addLoopLoadStores(n) {
18253 const [body_block] = n.blocks();
18254 const loop_vars = this.addControlFlowLoadStores(body_block);

Callers 1

Calls 7

blocksMethod · 0.80
definedVariablesMethod · 0.80
findInAnyFrameMethod · 0.80
addBlockOutputMethod · 0.80
addNodeOutputMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected