Skip to content

Instantly share code, notes, and snippets.

[i if i is True else 'nope' for i in [True, False, True]]
# [True, 'nope', True]
# Notice this is a conditional expression and different from list comprehension
# Which typically is `for ... if ...`
# Now it's reversed and no expression for truthy condition `if x <condition> else <expression>`
i
me
my
myself
we
our
ours
ourselves
you
your
@diixo
diixo / tf.py
Created January 29, 2021 18:03 — forked from koaning/tf.py
tensorflow layer example
import tensorflow as tf
import numpy as np
import uuid
x = tf.placeholder(shape=[None, 3], dtype=tf.float32)
nn = tf.layers.dense(x, 3, activation=tf.nn.sigmoid)
nn = tf.layers.dense(nn, 5, activation=tf.nn.sigmoid)
encoded = tf.layers.dense(nn, 2, activation=tf.nn.sigmoid)
nn = tf.layers.dense(encoded, 5, activation=tf.nn.sigmoid)
nn = tf.layers.dense(nn, 3, activation=tf.nn.sigmoid)