Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

neilisaac / torch   python

Repository URL to install this package:

Version: 1.8.0 

/ contrib / playground / resnetdemo / caffe2_resnet50_default_forward.py






import caffe2.python.models.resnet as resnet


def gen_forward_pass_builder_fun(self, model, dataset, is_train):
    def create_resnet50_model_ops(model, loss_scale):
        [softmax, loss] = resnet.create_resnet50(
            model,
            "data",
            num_input_channels=3,
            num_labels=1000,
            label="label",
        )
        model.Accuracy([softmax, "label"], "accuracy")

        my_loss_scale = 1. / self.opts['distributed']['num_xpus'] / \
            self.opts['distributed']['num_shards']

        loss = model.Scale(loss, scale=my_loss_scale)

        return [loss]
    return create_resnet50_model_ops