clab / clab/dynet

Support for manual vector dimension value assignment of expression

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

Description

I'm trying to write a seq2seq with out-of-vocab copy, for which I create a zeros input vector in the size of the out-of-vocab tokens:
```python
copy_vec = dy.inputVector(np.zeros(len(copy_vocab)))
```
But after I value each token seperately (conditional copy mechanism) and have a score for the token, I want to add to that word's scrore so I do:
```python
copy_vec[copy_vocab.w2i[token]] += token_score
```

Which is deriveable as it's a sum, and should just change the expression in that dimension to be a sum of expressions, as far as I understand.

Error:
> TypeError: '_dynet._vecInputExpression' object does not support item assignment

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the dy.inputVector example and the _vecInputExpression item-assignment error described in the issue. Reproduce the per-token update with a minimal seq2seq-style vector example, then trace the relevant expression and binding behavior. Done means indexed assignment can accumulate token_score expressions without raising the reported TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.