325d8412d641af7e52f97e3422e9ef516e4ef726,inferno/trainers/basic.py,Trainer,wrap_batch,#Trainer#Any#Any#Any#Any#,1028
Before Change
// Cast to the right dtype
batch = self.cast(batch)
// Second, wrap as variable
batch = type(batch)([Variable(_batch, requires_grad=requires_grad, volatile=volatile)
for _batch in batch])
return batch
def next_iteration(self):
self._iteration_count += 1
After Change
batch = self.cast(batch)
// Second, wrap as variable
variable_batch = []
for batch_num, _batch in enumerate(batch):
if thu.is_tensor(_batch):
variable_batch.append(Variable(batch, requires_grad=requires_grad,
volatile=volatile))
elif pyu.is_listlike(_batch):
variable_batch.append([Variable(__batch, requires_grad=requires_grad,
volatile=volatile)
for __batch in _batch])
else:
raise RuntimeError(f"Was Expecting batch at index {batch_num} to be either a "
f"tensor or a list of tensors. Got {type(_batch)} instead.")
batch = type(batch)(variable_batch)
return batch
def next_iteration(self):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: inferno-pytorch/inferno
Commit Name: 325d8412d641af7e52f97e3422e9ef516e4ef726
Time: 2018-07-05
Author: nasim.rahaman@iwr.uni-heidelberg.de
File Name: inferno/trainers/basic.py
Class Name: Trainer
Method Name: wrap_batch
Project Name: matplotlib/matplotlib
Commit Name: 1cfdb741661c2c9083235f258512c39cecae0da0
Time: 2019-02-06
Author: anntzer.lee@gmail.com
File Name: lib/matplotlib/backends/backend_qt5.py
Class Name: NavigationToolbar2QT
Method Name: edit_parameters
Project Name: leonsim/simhash
Commit Name: 6e8898b82f4591fe2256ca56be3c98836fe94b88
Time: 2017-10-31
Author: akellne@users.noreply.github.com
File Name: simhash/__init__.py
Class Name: Simhash
Method Name: __init__