clab / clab/dynet

Initialising higher-order lookup parameters

Open
#1,591 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
3.4k
Forks
701
PR merge metrics
No merged PRs in 30d

Description

A lookup parameter tensor with shape (a,b) can be initialised using `init_from_array` or `init_row`. However, trying to initialise a higher-order lookup parameter, for example with shape (a,b,c), raises an error:

```python
Traceback (most recent call last):
...
File "_dynet.pyx", line 1168, in _dynet.LookupParameters.init_from_array
File "_dynet.pyx", line 1183, in _dynet.LookupParameters.init_from_array
File "stringsource", line 48, in vector.from_py.__pyx_convert_vector_from_py_float
TypeError: only size-1 arrays can be converted to Python scalars
```

```python
Traceback (most recent call last):
...
File "_dynet.pyx", line 1223, in _dynet.LookupParameters.init_row
File "stringsource", line 48, in vector.from_py.__pyx_convert_vector_from_py_float
TypeError: only size-1 arrays can be converted to Python scalars
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in _dynet.pyx at LookupParameters.init_from_array and LookupParameters.init_row, then reproduce the reported TypeError with a lookup parameter shaped (a,b,c). Done means both initialization entry points accept higher-order arrays without scalar-conversion errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.