This file contains 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
import tensorflow as tf | |
def generate_gol_example(size): | |
"""Generates a random pair of Game of Life 2D world and its next time step. | |
For a reference on Game of Life, see | |
[Wikipedia page](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life). | |
The implementation assumes: | |
* 2D square world of fixed size. |
This file contains 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
import tensorflow as tf | |
def gol_loss(world_next_probabilities, world_next_target): | |
"""Calculates loss between 2D Game of Life predictions and targets. | |
For a reference on Game of Life, see | |
[Wikipedia page](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life). | |
The implementation assumes: | |
* 2D square world of fixed size. |
This file contains 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
var SearchForm = Frame.createClass({ | |
render: function() { | |
return ( | |
<input id="search-box" type="text" /> | |
<input id="search-button" type="button" /> | |
) | |
} | |
}); | |
var SearchResults = Frame.createClass({ |
This file contains 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
function emptySet(x) { | |
return false; | |
} | |
function insert(elem, set) { | |
return function(x) { | |
if (x === elem) { // insert smarter comparison here if needed | |
return true; | |
} | |
return function() { return contains(x, set); }; |