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
<html> | |
<head> | |
<title>Rotating Spinner Icon</title> | |
</head> | |
<body> | |
<svg id="loading-spinner" xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"> | |
<g fill="none"> |
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 | |
from copy import deepcopy | |
def copy_tensor_to_graph(tensor, to_graph, cached_tensors, scope=''): | |
if scope != '': | |
new_name = scope + '/' + tensor.name | |
else: | |
new_name = tensor.name |
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 numpy as np | |
import time | |
def timeit(func): | |
def _(*args, **kwargs): | |
start = time.time() | |
res = func(*args, **kwargs) | |
end = time.time() - start | |
print('Func: %s, runtime: %.6f' % (func.__name__, end)) |
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 | |
import os | |
tf.app.flags.DEFINE_string('output_dir', '/tmp/factorial_output', | |
"""Directory where to export inference model.""") | |
tf.app.flags.DEFINE_integer('model_version', 1, | |
"""Version number of the model.""") | |
FLAGS = tf.app.flags.FLAGS |
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 sys | |
import ctypes | |
pyint_p = ctypes.POINTER(ctypes.c_byte*sys.getsizeof(5)) | |
five = ctypes.cast(id(5), pyint_p) | |
print(2 + 2 == 5) # False | |
five.contents[five.contents[:].index(5)] = 4 | |
print(2 + 2 == 5) # True (must be sufficiently large values of 2 there...) |
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
# -*- coding:utf-8 -*- | |
'写了一个简单的支持中文的正向最大匹配的机械分词,其它不用解释了,就几十行代码' | |
'搜狗词库下载地址:http://vdisk.weibo.com/s/7RlE5' | |
import string | |
__dict = {} | |
def load_dict(dict_file='words.dic'): | |
'加载词库,把词库加载成一个key为首字符,value为相关词的列表的字典' |