A package to perform slice assignment in TensorFlow
Project description
tf-slice-assign
A tool for assignment to a slice in TensorFlow.
In TensorFlow, as opposed to Pytorch, it is currently impossible to assign to
the slice of a tensor in a range of different settings.
To mitigate this issue, tf-slice-assign
introduces a single function that
allows to do exactly this using tensor_scatter_nd_update
.
Use
from tf_slice_assign import slice_assign
new_tensor = slice_assign(old_tensor, assignment, *slice_args)
You can find a relatively simple example here.
Installation
pip install tf-slice-assign
List of GitHub issues and StackOverflow questions regarding TensorFlow slice assignment
In the following table, I am trying to give the reasons as to why no mitigation for the current problem exists.
Link | Status |
---|---|
SO | Current answer requires creating a tf.Variable for each slice assignment you make |
GH | Question is about tf.Variable |
SO | Answers for tf.Variable or using tensor_scatter_update in a non-adaptable way |
GH | Suggestion to use tensor_scatter_nd_update |
GH | An answer suggest creating a mask, but a mask can actually be as difficult to create as the indices for tensor_scatter_nd_update |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tf-slice-assign-0.0.4.tar.gz
(4.7 kB
view hashes)
Built Distribution
Close
Hashes for tf_slice_assign-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bd65295bd2b18ee46384b2832fa427b419471f54126eb1a2e5daa5827464b2b |
|
MD5 | df6d0e3a4f663a471e1bc3461d55f2a8 |
|
BLAKE2b-256 | 4cd68e4bd22ac95d42928b95f90f54d8e9849bbb7b2b4d4936d6905dc98cc7e0 |