Skip to content

Instantly share code, notes, and snippets.

View tamnguyenvan's full-sized avatar

Tam Nguyen tamnguyenvan

  • Ha Noi Viet Nam
View GitHub Profile
@tamnguyenvan
tamnguyenvan / slice_assignment.py
Created April 20, 2020 02:59
Tensorflow slice assignment.
import tensorflow as tf
# tf.enable_eager_execution() # uncomment if tf version < 2.0
def assign(x, slices, values):
"""Assign slicing-tensor to the given values.
Args
:x: A `Tensor` as input.
:slices: A `Tensor`, `list` or `numpy array` indicates the region