630aca5c7d9629c3714b244638dba81370a2ae89,deepchem/data/pytorch_datasets.py,_TorchNumpyDataset,__iter__,#_TorchNumpyDataset#,28

Before Change


      if self.deterministic:
        order = first_sample + np.arange(last_sample - first_sample)
      else:
        order = first_sample + np.random.permutation(last_sample - first_sample)
      for i in order:
        yield (self.numpy_dataset._X[i], self.numpy_dataset._y[i],
               self.numpy_dataset._w[i], self.numpy_dataset._ids[i])

After Change


      else:
        // Ensure that every worker will pick the same random order for each epoch.
        random = np.random.RandomState(epoch)
        order = random.permutation(n_samples)[first_sample:last_sample]
      if self.batch_size is None:
        for i in order:
          yield (self.numpy_dataset._X[i], self.numpy_dataset._y[i],
                 self.numpy_dataset._w[i], self.numpy_dataset._ids[i])
      else:
        for i in range(0, len(order), self.batch_size):
          indices = order[i:i + self.batch_size]
          yield (self.numpy_dataset._X[indices], self.numpy_dataset._y[indices],
                 self.numpy_dataset._w[indices],
                 self.numpy_dataset._ids[indices])


class _TorchDiskDataset(torch.utils.data.IterableDataset):  // type: ignore

  def __init__(self,
               disk_dataset: DiskDataset,
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: deepchem/deepchem
Commit Name: 630aca5c7d9629c3714b244638dba81370a2ae89
Time: 2020-08-19
Author: peastman@stanford.edu
File Name: deepchem/data/pytorch_datasets.py
Class Name: _TorchNumpyDataset
Method Name: __iter__


Project Name: deepchem/deepchem
Commit Name: 630aca5c7d9629c3714b244638dba81370a2ae89
Time: 2020-08-19
Author: peastman@stanford.edu
File Name: deepchem/data/pytorch_datasets.py
Class Name: _TorchImageDataset
Method Name: __iter__


Project Name: GPflow/GPflow
Commit Name: d47446fc6341f0b99373eed2ba252e321d6c1a1a
Time: 2020-03-23
Author: st--@users.noreply.github.com
File Name: gpflow/models/gplvm.py
Class Name: BayesianGPLVM
Method Name: __init__