This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def spectral_normalization(W, num_iters=1, name='spectral_normalization'): | |
| with tf.variable_scope(name, reuse=tf.AUTO_REUSE): | |
| def l2_normalize(v, eps=1e-12): | |
| return v / (tf.reduce_sum(v ** 2) ** 0.5 + eps) | |
| # Usually num_iters = 1 will be enough | |
| W_shape = W.shape.as_list() | |
| W_reshaped = tf.reshape(W, [-1, W_shape[-1]]) | |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {0: 'tench, Tinca tinca', | |
| 1: 'goldfish, Carassius auratus', | |
| 2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias', | |
| 3: 'tiger shark, Galeocerdo cuvieri', | |
| 4: 'hammerhead, hammerhead shark', | |
| 5: 'electric ray, crampfish, numbfish, torpedo', | |
| 6: 'stingray', | |
| 7: 'cock', | |
| 8: 'hen', | |
| 9: 'ostrich, Struthio camelus', |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| He_gain = 2.0 | |
| He_n = (fan_in * (kernel_size ** 2)) | |
| # Most stable performance in my experience. | |
| He_c_trunc_norm = np.sqrt(1.3 * He_gain / He_n) | |
| He_normal_init = tf.initializers.truncated_normal(stddev=He_c_trunc_norm) | |
| He_c_uniform = np.sqrt(3.0 * He_gain / He_n) | |
| He_uniform_init = tf.initializers.random_uniform(minval=-He_c_uniform, maxval=He_c_uniform) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from IPython.lib.backgroundjobs import BackgroundJobManager | |
| from IPython.core.magic import register_line_magic | |
| from IPython.display import display | |
| from IPython import get_ipython | |
| from itertools import islice, chain | |
| from ipywidgets import IntProgress, HTML, VBox | |
| # Iterate through a generator without peaking, yeilding a list of elements | |
| # | |
| def chunks(iterable, size): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| This is a module to convert between one dimensional distance along a | |
| `Hilbert curve`_, :math:`h`, and N-dimensional coordinates, | |
| :math:`(x_0, x_1, ... x_N)`. The two important parameters are :math:`N` | |
| (the number of dimensions, must be > 0) and :math:`p` (the number of | |
| iterations used in constructing the Hilbert curve, must be > 0). | |
| We consider an N-dimensional `hypercube`_ of side length :math:`2^p`. | |
| This hypercube contains :math:`2^{N p}` unit hypercubes (:math:`2^p` along | |
| each dimension). The number of unit hypercubes determine the possible |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.