Hierarchical lossless coding using CNN predictors alternately optimized with their assignment rules