code: function() {
  
    var b = test_batch;
    var k = Math.floor(Math.random()*num_samples_per_batch);
    var n = b*num_samples_per_batch+k;
  
    var p = img_data[b].data;
    var x = new convnetjs.Vol(image_dimension,image_dimension,image_channels,0.0);
    var W = image_dimension*image_dimension;
    var j=0;
    for(var dc=0;dc<image_channels;dc++) {
      var i=0;
      for(var xc=0;xc<image_dimension;xc++) {
        for(var yc=0;yc<image_dimension;yc++) {
          var ix = ((W * k) + i) * 4 + dc;
          x.set(yc,xc,dc,p[ix]/255.0-0.5);
          i++;
        }
      }
    }
  
    // distort position and maybe flip
    var xs = [];
    
    if (random_flip || random_position){
      for(var k=0;k<6;k++) {
        var test_variation = x;
        if(random_position){
          var dx = Math.floor(Math.random()*5-2);
          var dy = Math.floor(Math.random()*5-2);
          test_variation = convnetjs.augment(test_variation, image_dimension, dx, dy, false);
        }
        
        if(random_flip){
          test_variation = convnetjs.augment(test_variation, image_dimension, 0, 0, Math.random()<0.5); 
        }
  
        xs.push(test_variation);
      }
    }else{
      xs.push(x, image_dimension, 0, 0, false); // push an un-augmented copy
    }
    
    // return multiple augmentations, and we will average the network over them
    // to increase performance
    return {x:xs, label:labels[n]};
  }
docs: sample a random testing instance