1. Python style
Generally follow PEP8 Python style guide
But! Try to use Tensorflow
wherever it useful (or possible...)
2. Tensors
- Operations that deal with batches may assume that the
first dimension
of a Tensor is the batch dimension.
1. Python style
Generally follow PEP8 Python style guide
But! Try to use Tensorflow
wherever it useful (or possible...)
2. Tensors
first dimension
of a Tensor is the batch dimension.# Bacterial Foraging Optimization Algorithm | |
# (c) Copyright 2013 Max Nanis [max@maxnanis.com]. | |
import os, random, math, csv | |
class BFOA(): | |
def __init__(self, pop_size = 100, problem_size = 2, dimension = [-1, 1], elim_disp_steps = 1, repro_steps = 4, chem_steps = 30): | |
self.step_index = 0 | |
self.run_id = os.urandom(6).encode('hex') |
# https://github.com/tensorflow/probability/blob/master/tensorflow_probability/python/monte_carlo.py | |
# Copyright 2018 The TensorFlow Probability Authors. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software |
I upgraded my iPhone 5s to iOS 10 and could no longer retrieve photos from it. This was unacceptable for me so I worked at achieving retrieving my photos. This document is my story (on Ubuntu 16.04).
The solution is to compile libimobiledevice and ifuse from source.
Who is this guide intended for?
import numpy as np | |
import theano | |
import theano.tensor as T | |
import lasagne | |
from collections import OrderedDict | |
def get_adam_steps_and_updates(all_grads, params, learning_rate=0.001, | |
beta1=0.9, beta2=0.999, epsilon=1e-8): | |
t_prev = theano.shared(lasagne.utils.floatX(0.)) |
"""Short and sweet LSTM implementation in Tensorflow. | |
Motivation: | |
When Tensorflow was released, adding RNNs was a bit of a hack - it required | |
building separate graphs for every number of timesteps and was a bit obscure | |
to use. Since then TF devs added things like `dynamic_rnn`, `scan` and `map_fn`. | |
Currently the APIs are decent, but all the tutorials that I am aware of are not | |
making the best use of the new APIs. | |
Advantages of this implementation: |