model.set_dim("nI", get_width(X))
if Y is not None:
model.set_dim("nO", get_width(Y))
nO = model.get_dim("nO")
nI = model.get_dim("nI")
depth = model.get_dim("depth")
dirs = model.get_dim("dirs")
// It"s easiest to use the initializer if we alloc the weights separately
// and then stick them all together afterwards. The order matters here:
// we need to keep the same format that CuDNN expects.
params = []
// Convenience
init_W = partial(init_W, model.ops)
init_b = partial(init_b, model.ops)
layer_nI = nI
for i in range(depth):
for j in range(dirs):
// Input-to-gates weights and biases.
params.append(init_W((nO, layer_nI)))
params.append(init_W((nO, layer_nI)))
params.append(init_W((nO, layer_nI)))
params.append(init_W((nO, layer_nI)))
params.append(init_b((nO,)))
params.append(init_b((nO,)))
params.append(init_b((nO,)))
params.append(init_b((nO,)))
// Hidden-to-gates weights and biases
params.append(init_W((nO, nO)))
params.append(init_W((nO, nO)))
params.append(init_W((nO, nO)))
params.append(init_W((nO, nO)))
params.append(init_b((nO,)))
params.append(init_b((nO,)))
After Change
model.set_dim("nI", get_width(X))
if Y is not None:
model.set_dim("nO", get_width(Y))
nH = int(model.get_dim("nO") / model.get_dim("dirs"))
nI = model.get_dim("nI")
depth = model.get_dim("depth")
dirs = model.get_dim("dirs")