Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Dense init bug where initialisation of kernel weights with a numpy array raises a TypeError #3592

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion bindings/python/cntk/layers/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ def Dense(shape, activation=default_override_or(identity), init=default_override
infer_input_rank_to_map = map_rank # infer W to use all input dims except the first static 'map_rank' ones

# parameters bound to this Function
init_weights = _initializer_for(init, Record(output_rank=output_rank))
if isinstance(init, np.ndarray):
init_weights = init
else:
init_weights = _initializer_for(init, Record(output_rank=output_rank))

W = Parameter(input_shape + output_shape, init=init_weights, name='W')
b = Parameter( output_shape, init=init_bias, name='b') if bias else None

Expand Down