This is a hyper-technical post, only for despicable freaks like me.
Maybe somebody is looking for similar functions so if that’s the case, feel free to copy paste.
For a project I’m working on, I needed to sample a tensor, but keep it inside the original tensorflow graph.
So I had to sample the tensor, keep the remainder, and then get back the original tensor together, as if
nothing had happened. I found a way to do it. I call it sample and desample. For another part of the project
I needed a random slice of a multidimensional tensor, and put it back to its original form, to have it
back in the graph. I call it slice and deslice. I’m going to explain how I did it, and how it works.
You can find the code here,
and give a try to the containing package that I’m building here.
I’d love to get some feedback.