Exemple #1
0
def create_random_input():
    """
    Create a simple dataset where output = input_1 * 2.0
    """
    datasets = collections.OrderedDict()
    datasets['simple'] = {
        'train':
        torch.utils.data.DataLoader(utils.NumpyDatasets(input_1=np.random.rand(
            10, 100), ),
                                    batch_size=10,
                                    shuffle=False),
        'valid':
        torch.utils.data.DataLoader(utils.NumpyDatasets(input_1=np.random.rand(
            10, 100), ),
                                    batch_size=10,
                                    shuffle=False)
    }
    return datasets
Exemple #2
0
 def inputs_fn():
     datasets = collections.OrderedDict()
     datasets['dataset_1'] = {
         'train':
         torch.utils.data.DataLoader(utils.NumpyDatasets(
             var_x1=np.asarray([[-1, -1], [1, -1], [-1, 1], [1, 1]]),
             var_y=np.asarray([0, 1, 1, 0])),
                                     batch_size=100)
     }
     return datasets
Exemple #3
0
def create_simple_regression():
    """
    Create a simple dataset where output = input_1 * 2.0
    """
    datasets = collections.OrderedDict()
    datasets['simple'] = {
        'train':
        torch.utils.data.DataLoader(utils.NumpyDatasets(
            input_1=np.array([[1.0], [2.0], [3.0], [4.0], [5.0]]),
            output=np.array([[2.0], [4.0], [6.0], [8.0], [10.0]])),
                                    batch_size=100)
    }
    return datasets