资源算法nninit

nninit

2019-09-18 | |  119 |   0 |   0

nninit

Weight initialization schemes for PyTorch nn.Modules. This is a port of the popular nninit for Torch7 by @kaixhin.

Update

This repo has been merged into PyTorch's nn module, I recommend you use that version going forward.

PyTorch Example

import nninitfrom torch import nnimport torch.nn.init as initimport numpy as npclass Net(nn.Module):
  def __init__(self):
     super(Net, self).__init__()
     self.conv1 = nn.Conv2d(5, 10, (3, 3))
     init.xavier_uniform(self.conv1.weight, gain=np.sqrt(2))
     init.constant(self.conv1.bias, 0.1)network = Net()

Installation

Clone the repo and run python setup install

Usage

import nninitfrom torch import nnimport numpy as npclass Net(nn.Module):
  def __init__(self):
     super(Net, self).__init__()
     self.conv1 = nn.Conv2d(5, 10, (3, 3))
     nninit.xavier_uniform(self.conv1.weight, gain=np.sqrt(2))
     nninit.constant(self.conv1.bias, 0.1)network = Net()

Supported Schemes


上一篇:Character-level convolutional neural nets for text classification

下一篇:E2FAR

用户评价
全部评价

热门资源

  • TensorFlow-Course

    This repository aims to provide simple and read...

  • seetafaceJNI

    项目介绍 基于中科院seetaface2进行封装的JAVA...

  • mxnet_VanillaCNN

    This is a mxnet implementation of the Vanilla C...

  • vsepp_tensorflow

    Improving Visual-Semantic Embeddings with Hard ...

  • DuReader_QANet_BiDAF

    Machine Reading Comprehension on DuReader Usin...