clab / clab/dynet

set values of a sub tensor

Open
#920 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

It would be great if we could have an operation (e.g., `set_subtensor`) that could set values of given indices of a tensor `X`. In theano this is implemented as [`theano.tensor.set_subtensor`](http://deeplearning.net/software/theano/library/tensor/basic.html#theano.tensor.set_subtensor).

For example:

```
X = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] # tensor of shape (a, b)
idx = [1, 2] # 1-d tensor of shape (k,) where k <= a
values = [[1, 1, 1], [2, 2, 2]] # tensor of shape (k, b)

Y = dy.set_subtensor(X, idx, values)
Y = [[1, 2, 3], [1, 1, 1], [2, 2, 2]]
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.