added loss output for plottinadded loss output for plottingg