pyspark/bigdl/models/lenet/utils.py
def preprocess_mnist(sc, options):
    """
    Preprocess mnist dataset.
    Normalize and transform into Sample of RDDs.
    """
    train_data = get_mnist(sc, "train", options.dataPath)\
        .map(lambda rec_tuple: (normalizer(rec_tuple[0], mnist.TRAIN_MEAN, mnist.TRAIN_STD),
                                rec_tuple[1]))\
        .map(lambda t: Sample.from_ndarray(t[0], t[1]))
    test_data = get_mnist(sc, "test", options.dataPath)\
        .map(lambda rec_tuple: (normalizer(rec_tuple[0], mnist.TEST_MEAN, mnist.TEST_STD),
                                rec_tuple[1]))\
        .map(lambda t: Sample.from_ndarray(t[0], t[1]))
    return train_data, test_data
def preprocess_mnist(sc, options):
    """
    Preprocess mnist dataset.
    Normalize and transform into Sample of RDDs.
    """
    train_data = get_mnist(sc, "train", options.dataPath)\
        .map(lambda rec_tuple: (normalizer(rec_tuple[0], mnist.TRAIN_MEAN, mnist.TRAIN_STD),
                                rec_tuple[1]))\
        .map(lambda t: Sample.from_ndarray(t[0], t[1]))
    test_data = get_mnist(sc, "test", options.dataPath)\
        .map(lambda rec_tuple: (normalizer(rec_tuple[0], mnist.TEST_MEAN, mnist.TEST_STD),
                                rec_tuple[1]))\
        .map(lambda t: Sample.from_ndarray(t[0], t[1]))
    return train_data, test_data
def preprocess_mnist ( sc , options ) : train_data = get_mnist ( sc , "train" , options . dataPath ) . map ( lambda rec_tuple : ( normalizer ( rec_tuple [ 0 ] , mnist . TRAIN_MEAN , mnist . TRAIN_STD ) , rec_tuple [ 1 ] ) ) . map ( lambda t : Sample . from_ndarray ( t [ 0 ] , t [ 1 ] ) ) test_data = get_mnist ( sc , "test" , options . dataPath ) . map ( lambda rec_tuple : ( normalizer ( rec_tuple [ 0 ] , mnist . TEST_MEAN , mnist . TEST_STD ) , rec_tuple [ 1 ] ) ) . map ( lambda t : Sample . from_ndarray ( t [ 0 ] , t [ 1 ] ) ) return train_data , test_data
Preprocess mnist dataset.
    Normalize and transform into Sample of RDDs.
Preprocess mnist dataset . Normalize and transform into Sample of RDDs .