serhii.net

In the middle of the desert you can say anything you want

30 Jul 2019

Day 211

Python – how to run a Python script inside live shell

Or, from the same SO thread, one can do just import filename_without_extension, even if it doesn’t follow the structure with main() etc., in my experience.

Tensorflow

Indexing and slicing multi-dimensional arrays or tensors in pandas, numpy, Tensorflo

This is probably one of the most SEO titles I’ve ever created, but I think it applies to all of them.

Tensorflow add one dimension (expand dims, expand_dims)

# 't' is a tensor of shape [2]
tf.shape(tf.expand_dims(t, 0))  # [1, 2]
tf.shape(tf.expand_dims(t, 1))  # [2, 1]
tf.shape(tf.expand_dims(t, -1))  # [2, 1]
Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus