9dbf8ff1a0bf28ab804185f641cbce846a339c68,examples/mxnet_imagenet_resnet50.py,,train_gluon,#,297

Before Change


        for nbatch, batch in enumerate(train_data, start=1):
            data, label = batch_fn(batch, [context])
            with autograd.record():
                outputs = [net(x.astype(args.dtype, copy=False)) for x in data]
                loss = [loss_fn(yhat, y) for yhat, y in zip(outputs, label)]
            for l in loss:
                l.backward()
            trainer.step(batch_size)

After Change


            loss.backward()
            trainer.step(batch_size)

            metric.update([label], [output])
            if args.log_interval and nbatch % args.log_interval == 0:
                name, acc = metric.get()
                logging.info("Epoch[%d] Rank[%d] Batch[%d]\t%s=%f\tlr=%f",
                             epoch, rank, nbatch, name, acc, trainer.learning_rate)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: horovod/horovod
Commit Name: 9dbf8ff1a0bf28ab804185f641cbce846a339c68
Time: 2019-03-01
Author: linhaibin.eric@gmail.com
File Name: examples/mxnet_imagenet_resnet50.py
Class Name:
Method Name: train_gluon


Project Name: openeventdata/mordecai
Commit Name: 6ce8c41d5e859adbe9ea7fd517035b80752b7e19
Time: 2017-11-05
Author: ahalterman0@gmail.com
File Name: mordecai/geoparse.py
Class Name: Geoparse
Method Name: __init__


Project Name: pantsbuild/pants
Commit Name: 52c7c260e7c0a85e6b051af48b46e8fe9493b117
Time: 2020-08-04
Author: benjyw@gmail.com
File Name: src/python/pants/core/util_rules/determine_source_files.py
Class Name:
Method Name: determine_specified_source_files


Project Name: analysiscenter/batchflow
Commit Name: c15b97458069ea19aa0def4259264ae0c2b32644
Time: 2019-11-19
Author: dimonovez@gmail.com
File Name: batchflow/models/eager_torch/resnet.py
Class Name: ResNet
Method Name: body