createIntermediateNode = (curLayerIndex, selectedI, groupLayer, x, y,
  nodeIndex, stride, intermediateNodeMouseOverHandler,
  intermediateNodeMouseLeaveHandler, intermediateNodeClicked, interaction) => {
  let newNode = groupLayer.append('g')
    .datum(cnn[curLayerIndex - 1][nodeIndex])
    .attr('class', 'intermediate-node')
    .attr('cursor', interaction ? 'pointer': 'default')
    .attr('pointer-events', interaction ? 'all': 'none')
    .attr('node-index', nodeIndex)
    .on('mouseover', intermediateNodeMouseOverHandler)
    .on('mouseleave', intermediateNodeMouseLeaveHandler)
    .on('click', (d, g, i) => intermediateNodeClicked(d, g, i, selectedI,
      curLayerIndex));
  
  newNode.append('image')
    .attr('width', nodeLength)
    .attr('height', nodeLength)
    .attr('x', x)
    .attr('y', y);

  // Overlay the image with a mask of many small rectangles
  let strideTime = Math.floor(nodeLength / stride);
  let overlayGroup = newNode.append('g')
    .attr('class', 'overlay-group')
    .attr('transform', `translate(${x}, ${y})`);
  
  for (let i = 0; i < strideTime; i++) {
    for (let j = 0; j < strideTime; j++) {
      overlayGroup.append('rect')
        .attr('class', `mask-overlay mask-${i}-${j}`)
        .attr('width', stride)
        .attr('height', stride)
        .attr('x', i * stride)
        .attr('y', j * stride)
        .style('fill', 'var(--light-gray)')
        .style('stroke', 'var(--light-gray)')
        .style('opacity', 1);
    }
  }

  // Add a rectangle to show the border
  newNode.append('rect')
    .attr('class', 'bounding')
    .attr('width', nodeLength)
    .attr('height', nodeLength)
    .attr('x', x)
    .attr('y', y)
    .style('fill', 'none')
    .style('stroke', intermediateColor)
    .style('stroke-width', 1);
  
  return newNode;
}
Create a node group for the intermediate layer
@param {number} curLayerIndex Intermediate layer index
@param {number} selectedI Clicked node index
@param {element} groupLayer Group element
@param {number} x Node's x
@param {number} y Node's y
@param {number} nodeIndex Node's index
@param {function} intermediateNodeMouseOverHandler Mouse over handler
@param {function} intermediateNodeMouseLeaveHandler Mouse leave handler
@param {function} intermediateNodeClicked Mouse click handler
@param {bool} interaction Whether support interaction