Fixed cuda compile errors in image_output_layer.cu + small refactor