Loop for quad-nn.