-
tensorflow share parameter
tf.Variable()定义变量tf.Variable( initial_value=None,# 第一个参数是必填参数 trainable=True, collections=None, validate_shape=True, caching_device=None, name=None, variable_def=None, dtype=None, expected_shape=None, import_scope=Non...…
-
tensorflow print
tf.Print(input, data, message=None, first_n=None, summarize=None, name=None)最低要求两个输入,input和data,input是需要打印的变量的名字,data要求是一个list,里面包含要打印的内容。 message是需要输出的错误信息 first_n指只记录前n次 summarize是对每个tensor只打印的条目数量,如果是None,对于每个输入tensor只打印3个元素 name是op的名字a cod...…
-
tensorflow and cuda version
tensorflow各个版本需要的CUDA版本以及Cudnn的对应关系相应的网址为:tensorflow install for linux and macOStensorflow install for windows 版本 Python 版本 编译器 编译工具 cuDNN CUDA tensorflow_gpu-2.0.0-alpha0 2.7、3.3-3.6 ...…
-
tensor shape
tf.shape()import tensorflow as tfx = tf.constant([2,3,4,5])shape = tf.shape(x)with tf.Session() as sess: print(sess.run(shape))tensor.get_shape().as_list()import tensorflow as tfx = tf.constant([2,3,4,5])shape1 = x.get_shape()shape2 = x.get_shape(...…
-
save log file for bash output
A code example# Train and test the modelexport CUDA_VISIBLE_DEVICES=2dataset="xxx"LOG="./caches/$dataset.txt.`date +'%Y-%m-%d_%H-%M-%S'`"exec &> >(tee -a "$LOG")echo Logging output to "$LOG"echo 'Train the model ...'python train.py --dat...…
-
open for Python
Python open() 函数python open()函数用于打开一个文件,创建一个 file 对象,相关的方法才可以调用它进行读写。更多文件操作可参考:Python 文件I/O。function grammaropen(name[, mode[, buffering]])name: 一个包含了你要访问的文件名称的字符串值。mode: mode 决定了打开文件的模式:只读,写入,追加等。所有可取值见如下的完全列表。这个参数是非强制的,默认文件访问模式为只读(r)。buffering: ...…
-
SwitchyOmega + SS
a tool script forShadowSocksA secure socks5 proxy, designed to protect your Internet traffic. Support Windows, Mac OS X, Linux, Android, IOS.SwitchyOmegaManage and switch between multiple proxies quickly & easily. Changing proxy settings has n...…
-
docker command
images import and export sudo docker images sudo docker save -o **.tar image_name sudo docker load –input **.tarnew docker sudo docker images sudo docker run ….enter container docker exec -ti container_name bash (recommend) docker attach co...…
-
embedding representation visualization
a code exampleimport numpy as npfrom sklearn.manifold import TSNEimport matplotlib.pyplot as plt#embedding = np.loadtxt('word_embedding.txt', skiprows = 1)with open('word_embedding.txt', 'r') as fin: firstline = fin.readline().strip().split() ...…
-
git commands
Basic Git commandsHere is a list of some basic Git commands to get you going with Git.For more detail, check out the Atlassian Git Tutorials for a visual introduction to Git commands and workflows, including examples.commands Git task...…