自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(55)
  • 收藏
  • 关注

原创 nll loss 和CrossEntropyLoss 的一些区别

NLL Loss在传入这个loss前,需要先对输入进行一次 log_softmax 的变换, 例子如下:import torchimport torch.nn as nnimport torch.nn.functional as Fseed=1m = nn.LogSoftmax(dim=1)loss = nn.NLLLoss()# input is of size N x C = 3 x 5input = torch.randn(3, 5, requires_grad=True)pri

2020-12-28 19:04:34 1544

原创 mac 安装 pytorch_geometric ‘gcc‘ failed with exit status 1

遇到了官网提到的问题9:On macOS: ‘gcc’ failed with exit status 1: Install the respective packages by using the following environment variables (see Issue#21):MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py install然而这个命令是不对的,去看Issus#21提到的解决方案第一

2020-12-09 10:19:57 302

原创 python 基本函数之每天一个写bug小技巧 [useful function! -- something you will always use!]

目录testtest

2020-08-26 01:03:45 256

原创 RuntimeError: expected device cpu but got device cuda:0 --每天一个写 bug 小技巧

这是一个综合 debug 方法:不管是 expected cpu 还是 expected cuda, 本质原因都是类型不匹配。一般是因为:等号左边和右边类型不一样运算符左右两端类型不同同一个函数内,传入参数类型不同,比如 mutual...

2020-04-30 15:46:55 5260 4

原创 RL policy gradient 之 A2C, A3C,PPO小总结

A2C, A3C, PPO 都不是纯 policy based 的 RL 方法,准确地说是 Actor-Critic 方法,即,同时用到了 value function 和 policy funtion.这三种方法之间有什么区别呢?A2C这里的数字 2 其实是说有多少个 “A” 的意思, 作为 Actor-Critic 方法的一种,A2C 是在 Actor-Critic 方法的基础上多了一个...

2020-04-28 23:55:55 2126

原创 Latex figure 引用显示错误

在latex中插入图片后,引用发现,不显示标号或者是标号显示错误, 我遇到的是:明明写了引用:\ref{fig:1}\ref{fig:2}是不一样的,但是在 PDF 中,显示的是相同的 数字, 都是 Figure 1。一般是因为 \caption 和 \label 的相对未知不对。记住:\label 一定要放在 \caption 后面。参考...

2020-04-22 16:28:11 2612

原创 Missing number, treated as zero. to be read again Illegal unit of measure (pt inserted)

文章目录环境错误方法可行方法环境macOS+vscode+xelatex编译错误方法想在latex文档里插入并排的图片,一开始找到的博客说这么做: \begin{figure}[H] \centering \subfigure[场景1]{ \includegraphics[width=0.45\textwidth]{wolf2} } \subfig...

2020-04-22 14:07:38 5436 6

原创 KL散度理解

1. 形式一般而言,P代表数据x的真实分布,Q代表理论分布。离散:KL(P∣∣Q)=∑P(x)log⁡P(x)Q(x)KL(P||Q) = \sum P(x) \log \frac{P(x)}{Q(x)} \\KL(P∣∣Q)=∑P(x)logQ(x)P(x)​连续:KL(P∣∣Q)=∫P(x)log⁡P(x)Q(x)dxKL(P||Q) = \int P(x) \log \fra...

2019-10-23 11:14:27 405

原创 NONE LOCAL survey 2018-2019

none local neural networknon-local Neural Networks for Video ClassificationCVPR 2018motivated from `non-local mean operation, instead of adding layers, the authors choose to use none local mechan...

2019-10-16 20:10:37 397

原创 ubuntu 查看本机ip地址

ifconfig -a

2019-09-25 15:56:11 2658

转载 ssh 命令

具体看基础操作 1.登陆 ssh -p22 [email protected] 2.直接执行命令 -->最好全路径 ssh [email protected] ls -ltr /backup/data ...

2019-09-25 15:54:59 414

原创 latex 公式编辑方法

各种数学符号期望E\mathbb{E}公式1. 对齐\begin{align*} f(x) &= (x+a)(x+b) \\ &= x^2 + (a+b)x + ab\end{align*}

2019-09-19 13:34:12 1095

原创 object of type 'NoneType' has no len() -- python append 的大坑

我们都知道,python list 有好几种添加元素的方法:appendextend+然而这几种是有区别的,最坑的区别就是,使用append时,没有返回值也就是说,当在某个函数func()中传入 func(my_list.append(1)) 的话,往往是会报错的,因为传进去的是 None...

2019-09-16 21:24:00 8797 1

原创 python 生成requirements.txt 文件

1. pip生成生成当前python环境下的requirements.txt文件,即当前环境下的包版本直接敲命令pip freeze > requirements.txt 即可根据requirements.txt按照包有了requirements.txt怎么下载相应版本:pip install -r requirements.txt2.conda生成conda list -...

2019-09-11 19:17:40 255

原创 cpp 超常用tips! -- 每天一个写bug小技巧

c++ map 相当于python 中的dict, 一个关键词对应一个值(multimap可以对应多个值)map默认是排好序的,如果有需要用到排序的对,那么可以创建map来维护数据结构。那么如果要取根据关键词(key)排序的元素的最后一位应该怎么做呢:取最后一位元素参考auto iter = my_map.crbegin();...

2019-09-11 12:23:17 659

原创 c++ 读入一串数,未知长度,遇到回车停止

int n; vector<int> arr; while (cin >> n){ arr.push_back(n); if (cin.get() == '\n') break; }

2019-09-09 21:12:58 549

原创 python networkx 用法 -- 每天一个写 bug 小技巧

创建图import networkx as nxG = nx.Graph() # 创建空图G = nx.karate_club_graph() # 创建karate图,经典图之一(还有很多其他的可视化import networkx as nximport matplotlibmatplotlib.use("TkAgg")import matplotlib.pyplot as ...

2019-08-31 22:22:43 494

原创 CSDN markdown 文档编辑学习笔记 -持续更新

代码块目前支持代码类型: markup、html、svg、xml、c、clike、cpp、csharp、java、vbnet、go、ruby/rb、python/py、php、sql、perl、objectivec、swift、javascript/js、css、handlebars、bash、kotlin...

2019-08-25 14:09:57 196

原创 Latex学习笔记 -- 每天一个写 bug 小技巧

引用一般的latex模板会提供以.bst 结尾的文件,可以理解为bib style, 另外还有一个以.bib 结尾的文件, 比如现在我有两个文件 style.bst 和 cite.bib要完成引用只需在\end{document} 前加两行即可:\bibliographystyle{style}\bibliography{cite}...

2019-08-22 19:03:52 156

原创 Mac 安装相关 [持续更新]

安装brew/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"安装wgetbrew install wget

2019-08-22 13:12:00 128

原创 ubuntu 学习笔记

操作命令查看内存使用情况 1gnome-system-monitor参考https://www.cnblogs.com/fuhang/p/10086520.html ↩︎

2019-08-21 21:06:58 102

原创 vim 学习笔记 持续更新

位置跳转操作快捷键到文档开头gg到文档末尾G当前行开头0当前行末尾)向下翻半页ctrl + d向上翻半页ctrl + u编辑操作快捷键进入编辑模式i退出操作快捷键只退出:q保持然后退出:wq...

2019-08-21 20:45:25 84

原创 tmux 学习笔记 [持续更新]

ubuntu 环境安装:sudo apt install tmux进入tmuxtmux列出所有tmux窗口tmux ls窗口挂起 detachctrl + b -> d打开上次的窗口tmux a

2019-08-21 20:06:28 178

原创 tensorboard持续更新

查看loss曲线命令行:tensorboard --logdir=event所在的文件夹路径注意:是文件夹!接着会显示一个地址,点开,但是我从来没有成功打开过,直接在地址栏敲:http://localhost:6006 就可以...

2019-08-21 19:33:04 1206

原创 numpy random 持续更新

np.random.rand(d0,d1, …, dn)生成[0,1)之间的数np.random.randn(d0,d1, …, dn)标准正态分布np.random.randint(low, high=None, size=None, dtype = ‘I’)返回整数,区间为[low,high)size是数组大小...

2019-08-21 14:38:48 134

原创 conda 管理 [持续更新]

环境查看环境conda info --envsbase /Users/xxx/miniconda3community /Users/xxx/miniconda3/envs/communitytensorflow * /Users/xxx/miniconda3/envs/tensorflow...

2019-08-21 13:47:31 185

原创 bash shell 学习

循环按规律的数字循环for i in 'seg 10 40`do echo $idone注意:这是从10开始,以1为间隔,直到40停止的计数`` 不能省do 和 done必须有,且成对出现按规律的数字循环for i in 1 4 3 7 16do echo $idone不需要`` 也可以双层循环for s in 1 2 3do for i in '...

2019-08-20 19:40:26 131

原创 linux 命令学习记录 持续更新

删除删除文件rm删除带有某名字的文件夹参考例如当前目录下有以下文件夹1/2/3/a1/2/3/b10/20/30/a10/20/30/b100/200/300/a100/200/300/b我想删除所有名字为a的文件夹。使用find,filter只有目录,按名称过滤,exec rmdir:find -type d -name a -exec rmdir {} \;我的...

2019-08-20 11:57:52 119

原创 leetcode problem 84. Largest Rectangle in Histogram

DescriptionGiven n non-negative integers representing the histogram’s bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where widt...

2019-08-01 11:03:09 109

原创 leetcode problem 399. Evaluate Division

20190719DescriptionEquations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number (floating point number). Given some queries, return the a...

2019-07-19 22:02:41 119

原创 leetcode problem 312. Burst Balloons 20190718

DescriptionGiven n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the balloons. If the you burst balloon i you will...

2019-07-19 14:30:58 125

原创 what is mrr [Measurement Result Recording] ?

mrr 常出现在各种无监督模型中,以衡量模型的优劣性问题来了, 什么是 mrr?MRR是一个国际上通用的对搜索算法进行评价的机制,即第一个结果匹配,分数为1,第二个匹配分数为0.5,第n个匹配分数为1/n,如果没有匹配的句子分数为0。最终的分数为所有得分之和。1mrr 指标常见于搜索算法, 推荐算法。 具体场景如,搜索关键词kkk后, 算法根据rank值返回一系列候选:c1,c2,⋯&amp...

2019-06-14 22:01:13 211

原创 [tensorflow] tf.app.flags 使用

import tensorflow as tfflags = tf.app.flagsFLAGS = flags.FLAGSFLAGS 是一个全局变量。比如我现在有一个a.py文件,里面定义了:import tensorflow as tf flags = tf.app.flagsFLAGS = flags.FLAGS flags.DEFINE_float('learni...

2019-05-08 18:05:48 188

原创 [GraphSage Code] model.py

def aggregateneigh_dims = [batch_size * support_sizes[hop], num_samples[len(num_samples) - hop - 1], dim_mult*dims[layer]]support_size...

2019-05-02 17:05:22 227

原创 leetcode problem 62. Unique Paths [20190417]

DescriptionA robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to r...

2019-04-15 14:11:40 109

原创 leetcode problem 287. Find the Duplicate Number 20190416

DescriptionGiven an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicat...

2019-04-15 14:00:21 104

原创 leetcode problem 96. Unique Binary Search Trees

DescriptionGiven n, how many structurally unique BST’s (binary search trees) that store values 1 … n?Example:Input: 3Output: 5Explanation:Given n = 3, there are a total of 5 unique BST's: 1 ...

2019-04-14 23:17:10 81

原创 leetcode problem 538. Convert BST to Greater Tree

DescriptionGiven a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all keys greater than the original key in ...

2019-04-14 14:20:10 92

原创 Gaussian Process understanding

DefinitionKernel高斯过程的性质与其协方差函数有密切联系,在构造高斯过程时,一些特定形式的协方差函数被称为核函数。核函数的选择要求满足Mercer定理(Mercer’s theorem),即核函数在样本空间内的任意格拉姆矩阵(Gram matrix)为半正定矩阵(semi-positive definite。这里对高斯过程常见的核函数类型进行总结。径向基核: κ(r)=exp⁡...

2019-04-13 17:20:05 486

原创 networkx.draw() unrecognized selector sent to instance 0x7fe5e85f7fd0 解决 [mac] python3

import networkx as nx import matplotlib.pyplot as plt# generate a networkG = nx.random_graphs.barabasi_albert_graph(100,1) #生成一个BA无标度网络Gnx.draw(G) #绘制网络Gplt.savefig("...

2019-04-13 17:13:33 325

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除