X_train, y_train from ImageDataGenerator (Keras) Can I have X_train, y_train, X_test, y_test from data_generator?
Here is my code:

data_generator = ImageDataGenerator(
    rescale = 1. / 255, 
    shear_range = 0.2, 
    zoom_range = 0.2, 
    horizontal_flip = True,
    vertical_flip = True,
    rotation_range = 180,
    width_shift_range = 0.2,
    height_shift_range = 0.2,
    validation_split = 0.2) 

train_generator = data_generator.flow_from_directory(
    train_data_dir, 
    target_size =(img_width, img_height), 
    batch_size = batch_size,
    shuffle = True,
    class_mode = 'categorical',
    seed = 42,
    subset='training')

validation_generator = data_generator.flow_from_directory( 
    train_data_dir, 
    target_size =(img_width, img_height), 
    batch_size = batch_size,
    shuffle = True,
    class_mode = 'categorical',
    seed = 42,
    subset='validation')
in python 2:

X_train, y_train = train_generator.next()
 X_test, y_test = validation_generator.next()

in python 3:

X_train, y_train = next(train_generator)
X_test, y_test = next(validation_generator)