Solved by Nikronic in post #7 
              
              
                Based on the above code, you changing the sizes, before this, val and train are consistent. If you want to extract val dataset, first do the size changing then extract val. 

First, just separate your x and y, then do the dimension changes as you want, the extract val using list comprehension which…