+ transformations = torch.randint(5, (nb_transformations,))
+
+ for t in transformations:
+ if t == 0:
+ col, shp = col.flip(0), shp.flip(0)
+ descriptions += ["<chg> vertical flip"]
+ elif t == 1:
+ col, shp = col.flip(1), shp.flip(1)
+ descriptions += ["<chg> horizontal flip"]
+ elif t == 2:
+ col, shp = col.flip(0).t(), shp.flip(0).t()
+ descriptions += ["<chg> rotate 90 degrees"]
+ elif t == 3:
+ col, shp = col.flip(0).flip(1), shp.flip(0).flip(1)
+ descriptions += ["<chg> rotate 180 degrees"]
+ elif t == 4:
+ col, shp = col.flip(1).t(), shp.flip(1).t()
+ descriptions += ["<chg> rotate 270 degrees"]
+
+ col, shp = col.contiguous(), shp.contiguous()
+
+ return (col, shp), descriptions