MCPcopy Create free account
hub / github.com/tensorflow/tensorboard / buildGroup

Function buildGroup

tensorboard/plugins/graph/tf_graph_common/node.ts:87–194  ·  view source on GitHub ↗
(
  sceneGroup,
  nodeData: render.RenderNodeInfo[],
  sceneElement
)

Source from the content-addressed store, hash-verified

85 * @return selection of the created nodeGroups
86 */
87export function buildGroup(
88 sceneGroup,
89 nodeData: render.RenderNodeInfo[],
90 sceneElement
91) {
92 let container = tf_graph_common.selectOrCreateChild(
93 sceneGroup,
94 'g',
95 Class.Node.CONTAINER
96 );
97 // Select all children and join with data.
98 // (Note that all children of g.nodes are g.node)
99 let nodeGroups = (container as any)
100 .selectAll(function () {
101 return this.childNodes;
102 })
103 .data(nodeData, (d) => {
104 // make sure that we don't have to swap shape type
105 return d.node.name + ':' + d.node.type;
106 });
107 // ENTER
108 nodeGroups
109 .enter()
110 .append('g')
111 .attr('data-name', (d) => {
112 return d.node.name;
113 })
114 .each(function (d) {
115 let nodeGroup = d3.select(this);
116 // index node group for quick stylizing
117 sceneElement.addNodeGroup(d.node.name, nodeGroup);
118 })
119 .merge(nodeGroups)
120 // ENTER + UPDATE
121 .attr('class', (d) => {
122 return Class.Node.GROUP + ' ' + nodeClass(d);
123 })
124 .each(function (d) {
125 let nodeGroup = d3.select(this);
126 // Add g.in-annotations (always add -- to keep layer order
127 // consistent.)
128 let inAnnotationBox = tf_graph_common.selectOrCreateChild(
129 nodeGroup,
130 'g',
131 Class.Annotation.INBOX
132 );
133 buildGroupForAnnotation(
134 inAnnotationBox,
135 d.inAnnotations,
136 d,
137 sceneElement
138 );
139 // Add g.out-annotations (always add -- to keep layer order
140 // consistent.)
141 let outAnnotationBox = tf_graph_common.selectOrCreateChild(
142 nodeGroup,
143 'g',
144 Class.Annotation.OUTBOX

Callers 1

buildGroupForSceneFunction · 0.70

Calls 14

nodeClassFunction · 0.85
buildGroupForAnnotationFunction · 0.85
buildShapeFunction · 0.85
addButtonFunction · 0.85
addInteractionFunction · 0.85
subsceneBuildFunction · 0.85
labelBuildFunction · 0.85
enterMethod · 0.80
addNodeGroupMethod · 0.80
removeNodeGroupMethod · 0.80
removeAnnotationGroupMethod · 0.80
stylizeFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…