Skip to main content

tf-slice-assign

GitHub Workflow Build Status

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

Release files for tf-slice-assign 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tf-slice-assign 0.0.4
File Size Uploaded
tf-slice-assign-0.0.4.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tf-slice-assign 0.0.4
File Interpreter ABI Platform
tf_slice_assign-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 9.0 kB

Release files / tf-slice-assign-0.0.4.tar.gz

Download URL tf-slice-assign-0.0.4.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
83da73df9c4706b84256d763825e3536b0dba31e069689749c12a95c3245b8c6
BLAKE2b-256 checksum
How to use checksums
871a139d132ea27ff49f0bb1d91c4af097a1482613c40e0e4bec3add1d8bc942
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

Release files / tf_slice_assign-0.0.4-py3-none-any.whl

Download URL tf_slice_assign-0.0.4-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9bd65295bd2b18ee46384b2832fa427b419471f54126eb1a2e5daa5827464b2b
BLAKE2b-256 checksum
How to use checksums
4cd68e4bd22ac95d42928b95f90f54d8e9849bbb7b2b4d4936d6905dc98cc7e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page