serhii.net

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

07 Feb 2020

Day 403

Tensorflow

tf.math.count_nonzero() works for booleans, as in “number of True elements in tensor”

Python mutable/immutable dictionaries/lists changing inside a function

Tutorial: Why Functions Modify Lists, Dictionaries in Python just got bitten by this again :) TL;DR lists and dicts are mutable, therefore if I pass them to a function and it does stuff to it they will get changed outside the function too. dict.copy() helps.

Nel mezzo del deserto posso dire tutto quello che voglio.