Source code for openrl.modules.networks.utils.util import copy import torch.nn as nn [docs]def init(module, weight_init, bias_init, gain=1): weight_init(module.weight.data, gain=gain) if module.bias is not None: bias_init(module.bias.data) return module [docs]def get_clones(module, N): return nn.ModuleList([copy.deepcopy(module) for i in range(N)])