Skip to content

Instantly share code, notes, and snippets.

View Ouwen's full-sized avatar

Ouwen Huang Ouwen

View GitHub Profile
@Ouwen
Ouwen / Postgis_with_sequelize.js
Last active May 28, 2024 03:42
Using PostGIS with sequelize
'use strict';
var Q = require('q');
module.exports = function (sequelize, DataTypes) {
return sequelize.define('Snapshot', {
time: {
type: DataTypes.DATE
}
}, {

Keybase proof

I hereby claim:

  • I am ouwen on github.
  • I am ouwen (https://keybase.io/ouwen) on keybase.
  • I have a public key whose fingerprint is 8CAD 6915 BEB3 FB58 F2B6 2084 6619 292F 4B06 9111

To claim this, I am signing this object:

import tensorflow as tf
import numpy as np
# Let's explicitly create an empty graph: `g1`.
#
# Note, tensorflow has a default graph that can be used but we
# explicitly create `g1` for clarity.
g1 = tf.Graph()
# `my_input_value` is a tensor-like object.
@Ouwen
Ouwen / tensorflow_pbtxt_graph_load.py
Created July 25, 2018 18:16
Load a tensorflow graph from a .pbtxt
import tensorflow as tf
from google.protobuf import text_format
# Let's read our pbtxt file into a Graph protobuf
f = open("/tmp/storage/graph_protobuf.pbtxt", "r")
graph_protobuf = text_format.Parse(f.read(), tf.GraphDef())
# Import the graph protobuf into our new graph.
graph_clone = tf.Graph()
with graph_clone.as_default():
@Ouwen
Ouwen / graph_protobuf.pbtxt
Created July 25, 2018 18:30
Graph Protobuf Text Representation
node {
name: "input"
op: "Const"
attr {
key: "dtype"
value {
type: DT_FLOAT
}
}
attr {
import tensorflow as tf
g1 = tf.Graph()
with g1.as_default():
my_input = tf.constant([-1,0,1], dtype=tf.float16, name="input")
a = tf.square(my_input, name="A")
b = tf.cos(a, name="B")
c = tf.sin(a, name="C")
d = tf.add(b, c, name="D")
import tensorflow as tf
g1 = tf.Graph()
with g1.as_default():
my_input = tf.constant([-1,0,1], dtype=tf.float16, name="input")
# Add a print operation in between our "input" operation and "A" operation
my_printed_input = tf.Print(my_input, [], message="Running the graph.", name="print")
import tensorflow as tf
g1 = tf.Graph()
with g1.as_default():
my_input = tf.constant([-1,0,1], dtype=tf.float16, name="input")
my_printed_input = tf.Print(my_input, [], message="Running the graph", name="print")
a = tf.square(my_printed_input, name="A")
b = tf.cos(a, name="B")
c = tf.sin(a, name="C")