代码拉取完成,页面将自动刷新
import os
import random
import numpy as np
#initialize the weighs of the network for Convolutional layers and batchnorm layers
def weights_init(m):
classname = m.__class__.__name__
if classname.find('Conv') != -1 and classname.find('Conv2d') == -1:
m.weight.data.normal_(0.0, 0.02)
elif classname.find('BatchNorm') != -1 and classname.find('BatchNorm2d') == -1:
m.weight.data.normal_(1.0, 0.02)
m.bias.data.fill_(0)
class AverageValueMeter(object):
"""Computes and stores the average and current value"""
def __init__(self):
self.reset()
def reset(self):
self.val = 0
self.avg = 0
self.sum = 0
self.count = 0.0
def update(self, val, n=1):
self.val = val
self.sum += val * n
self.count += n
self.avg = self.sum / self.count
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。