forked from computerhistory/AlexNet-Source-Code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinitw.py
More file actions
executable file
·21 lines (17 loc) · 717 Bytes
/
initw.py
File metadata and controls
executable file
·21 lines (17 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from gpumodel import *
import numpy as n
import numpy.random as nr
def get_src():
src = IGPUModel.load_checkpoint('/nobackup/kriz/tmp/ConvNet__2012-09-19_23.29.04')
return src['model_state']['layers']
def makew(name, idx, shapes, params):
src, src_layer = get_src(), params[0]
if name == 'localcombine' and idx == 2:
return n.array(0.01 * nr.randn(shapes[0], shapes[1]), dtype=n.single, order='C')
return src[src_layer]['weights'][idx]
def makeb(name, shapes, params):
src, src_layer = get_src(), params[0]
return src[src_layer]['biases']
def makec(name, idx, shapes, params):
src, src_layer = get_src(), params[0]
return src[src_layer]['filterConns'][idx]