fixed get_layer_monitoring_channels in flattenerlayer and added test

FlattenerLayer.get_layer_monitoring_channels was failing when targets was None. I added a check for targets and also added a unit test for get_layer_monitoring_channels.