自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

  • 博客(63)
  • 资源 (2)
  • 问答 (4)
  • 收藏
  • 关注

原创 本地没有任何修改,只是git pull时,显示git ahead of ‘origin/master‘ by * commits

目录TL;DR问题原因解决方案TL;DR本地没有更改,只是从远程pull,但是显示Your branch is ahead of ‘origin/master’ by 3 commits.原因是从远程更新了本地的master 分支,但是没有更新本地的追踪分支 origin/master, 解决方案是运行:git fetch让本地追踪分支(tracing branch)和远程同步太长不看版到此结束,以下是具体原因和发现问题的经过。问题从服务器或者github clone下来之后,在本地还没

2021-07-12 14:06:59 2139

原创 重新更新博客

这里写自定义目录标题起因起因很久没有更新博客了,昨天从github上下载之后,hexo的命令全忘了。hexo g # 生成hexo d # 部署发现hexo直接类似这样的报错(我的log在重启之后没了,从网上找的大概是这个吧):TypeError [ERR_INVALID_ARG_TYPE]: The "mode" argument must be integer. Received an instance of Object一同操作下来,发现是自己的node.js版本不对,于

2021-03-18 07:06:30 122

原创 python数组复制的小坑

python数组赋值这里我只对[0][0]进行了赋值,但是可以看到第一列所有的值都发生了变化。这是因为对多元数组的乘法操作是直接引用。

2019-09-18 02:27:53 375

原创 [leetcode]46. 全排列

给定一个没有重复数字的序列,返回其所有可能的全排列。示例:输入: [1,2,3] 输出: [ [1,2,3], [1,3,2], [2,1,3], [2,3,1],[3,1,2], [3,2,1] ]解法还是回溯算法。思路还是很简单的,本来以为可以很轻松写完,却碰到了两个大坑:python的list复制和顺序问题。按照惯例,先贴出自己写的代码:class S...

2019-07-26 03:44:15 106

原创 [leetcode]22. 括号生成

给出 n 代表生成括号的对数,请你写出一个函数,使其能够生成所有可能的并且有效的括号组合。例如,给出 n = 3,生成结果为:[ “((()))”, “(()())”, “(())()”, “()(())”, “()()()” ]来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/generate-parenthese...

2019-07-22 04:03:06 222 1

原创 ssh

ssh copy idssh-keygenssh-copy-id -i ~/.ssh/id_rsa.pub name@host如果你有多个服务器的话,# zsh 写入命令function ssh2(){ cmd="ssh name@子网."$1 eval $cmd}以后只需要ssh2 101就会自动帮你登录了。...

2019-06-24 11:13:30 71

原创 ycm

问题:The ycmd server SHUT DOWN (restart with ':YcmRestartServ… using it. Follow the instructions in the documentation.系统:mac解决方案:xcode-select --install子模块的安装不要用anaconda安装,用系统自带的。cd ~/.vim/bund...

2019-05-23 04:17:59 604

原创 python捕获print标准输出

起因写函数的时候把需要用的东西都print了。结果后面要用的print的东西。又不想再return。索性像个办法把print捕获作为一个string。经过print的实质是调用了系统的标准输出,print("hello")sys.stdout.write('hello'+'\n')上面两句话是等价的。网上大都是有把输出重定向到文件,但是我只要输出作为string。先写入文件再...

2019-04-25 10:54:47 11363 9

原创 json不允许整数键

>>> import json>>> d = {1:2,2:3}>>> d{1: 2, 2: 3}>>> json.dumps(d)'{"1": 2, "2": 3}'

2019-04-21 13:09:31 626

原创 LSTM 备忘录

每一个batch都是一样的操作;比如说,每个batch的h_0和c_0都是一样的。

2019-04-16 00:22:07 77

原创 python @ 操作符

python的@ 除了用在装饰器上,还可以用在矩阵操作。效果大概等同于mul。ea = torch.randn(2,3)eb = torch.randn(3,2)ea.mm(eb)ea@eb输出结果为:tensor([[-0.4561, 0.5820], [-1.6594, -3.1745]])tensor([[-0.4561, 0.5820], ...

2019-04-15 23:55:08 2175

转载 python deepcopy

1. copy.copy 浅拷贝 只拷贝父对象,不会拷贝对象的内部的子对象。2. copy.deepcopy 深拷贝 拷贝对象及其子对象一个很好的例子:import copya = [1, 2, 3, 4, ['a', 'b']]  #原始对象b = ...

2019-04-15 16:36:05 2932

转载 Depthwise Separable Convolution详解

转载自常规卷积运算假设输入层为一个大小为64×64像素、三通道彩色图片。经过一个包含4个Filter的卷积层,最终输出4个Feature Map,且尺寸与输入层相同。整个过程可以用下图来概括。此时,卷积层共4个Filter,每个Filter包含了3个Kernel,每个Kernel的大小为3×3。因此卷积层的参数数量可以用如下公式来计算:N_std = 4 × 3 × 3 × 3 = 10...

2019-04-07 22:34:13 10860 7

转载 dumps unicode

sample code:import jsonjson_string = json.dumps(“ברי צקלה”)print json_string“\u05d1\u05e8\u05d9 \u05e6\u05e7\u05dc\u05d4”The problem: it’s not human readable. My (smart) users want to verify or ...

2019-04-02 20:50:09 682

原创 检查python程序速度瓶颈 cProfile

import cProfileimport pstatsimport my_slow_modulecProfile.run('my_slow_module.run()', 'restats')p = pstats.Stats('restats')p.sort_stats('cumulative').print_stats(30)

2019-03-19 19:37:33 339

原创 同步文件夹

rsync -avt e2e/ [email protected]:/e2e/

2019-03-12 19:49:22 166

转载 json

dump和dumps不一样。#dumps 将数据转换成字符串 json_str = json.dumps(test_dict) print(json_str) print(type(json_str))with open("../config/record.json","w") as f: json.dump(new_dict,f) print("加载入文件完成.....

2019-03-11 18:43:24 80

转载 python读写文件

模式描述t文本模式 (默认)。x写模式,新建一个文件,如果该文件已存在则会报错。b二进制模式。+打开一个文件进行更新(可读可写)。U通用换行模式(不推荐)。r以只读方式打开文件。文件的指针将会放在文件的开头。这是默认模式。rb以二进制格式打开一个文件用于只读。文件指针将会放在文件的开头。这是默认模式。一般用于非文本文件如图片等。r+打开一个文件用于读写。文件指针将会放在文件的开头...

2019-03-11 18:41:40 268

转载 attention机制

/* 版权声明:可以任意转载,转载时请标明文章原始出处和作者信息 .*/                             &a

2019-03-06 18:13:11 162

原创 remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git

Warning: These procedures will permanently remove files from the repository on your computer and GitHub. If the file is important, make a local backup copy in a directory outside of the repository....

2019-03-04 16:11:08 5616

原创 不跟踪文件

git rm --cached readme.txt

2019-03-04 15:33:21 114

原创 gdrive使用

https://www.howtoing.com/how-to-access-google-drive-from-linux-gdrive

2019-03-03 19:36:05 1906

原创 colab 挂载google drive

from google.colab import drivedrive.mount('/content/drive')

2019-03-03 18:56:23 1083

原创 torch.gather的三维实例

>>> atensor([[ 0.9918, 0.4911, 1.4912, -1.8491], [ 0.1257, -0.4406, 0.3371, 0.1205], [ 0.3064, -0.8198, 1.2851, 0.2486]])>>> btensor([[0, 1], [1, 2],...

2019-03-03 14:43:01 3057

原创 输出所有的属性和值

class Config(): def __init__(self): self.is_training = True # path self.train_path_mini = "../data/train.english.jsonlines.mini" self.train_path = "../data/train.en...

2019-03-02 11:49:11 319

原创 range arange

这是一个小坑,torch.range 已经被弃用了/torch.range(0,5)__main__:1: UserWarning: torch.range is deprecated in favor of torch.arange and will be removed in 0.5. Note that arange generates values in [start; end), ...

2019-03-01 21:49:55 1384

原创 nn.Embedding

当数组越界的时候报错是CUDA问题,并且在语句执行的时候不报错而是影响后面的语句执行。THCudaCheck FAIL file=/opt/conda/conda-bld/pytorch_1533672544752/work/aten/src/THC/generic/THCTensorCopy.cpp line=20 error=59 : device-side assert triggered...

2019-03-01 16:16:17 1396

转载 怎么固定预训练的embedding

class Network(nn.Module): def __init__(self, n_words, n_dim=5): super(Network, self).__init__() self.word_embed = nn.Embedding(n_words, n_dim, sparse=True)def freeze_layer(layer): for param in...

2019-02-27 22:20:03 2272 2

原创 怎么样用预训练的embedding

nn.Parameter(torch.from_numpy(emb).float())

2019-02-27 16:55:42 1509

原创 perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUA

perl: warning: Setting locale failed.perl: warning: Please check that your locale settings:LANGUAGE = (unset),LC_ALL = (unset),LC_CTYPE = “zh_CN.UTF-8”,LANG = “en_US.UTF-8”are supported and inst...

2019-02-14 15:38:55 882

原创 RuntimeError: cuDNN version mismatch: PyTorch was compiled against 7102 but linked against 7301

报错:RuntimeError: cuDNN version mismatch: PyTorch was compiled against 7102 but linked against 7301解决办法:conda install cudnn=7.1.2

2019-02-13 14:37:07 4776

转载 word2vec

Word2Vec Tutorial - The Skip-Gram Model 19 Apr 2016 This tutorial covers the skip gram neural network architecture for Word2Vec. My intention with this tutorial was to skip over the usual intro...

2018-07-23 20:56:42 383

转载 SFTP入门指南

By 华华 - 十二月, 5th 2015 什么是 SFTP ?在了解 SFTP 之前,我们先看看什么是 FTP 。FTP( File Transfer Protocol )文件传输协议,是一种常用来在两终端系统之间传输文件的方法。SF...

2018-07-07 07:11:48 1939

转载 乱码转换

txt文件在Windows下可以正常显示,Ubuntu下打开文件乱码。这是中文编码问题,Windows下用的是gb2312,而linux下用的是utf8。在此提供5种解决方案:在文档所在目录运行命令iconv -f gb2312 -t utf8 -c 1.txt > 2.txt 选项-c的作用是忽略不能识别的字符,继续向后转换。否则iconv遇到不能识别的字符就终止转换。 ic...

2018-04-11 23:08:44 20831

原创 Python私有变量

私有变量表示方法在变量前加上两个下划线的是私有变量。class Teacher(): def __init__(self,name,level): self.__name=name self.__level=level #获取老师的等级 def get_level(self): return self.__level #获取

2018-02-27 18:36:00 1019

原创 python装饰器

导语:语法糖也是毒药。装饰器个人定义当一个函数或者类功能不足,在不修改原有代码的基础上为它增加新的功能,而不影响原有代码的功能。简单装饰器在这里,就是装饰器最简单的实现。 通过高阶函数将原来的函数包含进来,然后返回功能更强大的函数g1。 如果在将新函数命名为f1,则原函数被彻底隐藏。 加语法糖这样写不太简洁,于是python给出了语法糖。 两种写法在实际上是...

2018-02-26 02:06:23 208

原创 python闭包问题

这是慕课网的学习记录和感想。# 希望一次返回3个函数,分别计算1x1,2x2,3x3:def count(): fs = [] for i in range(1, 4): def f(): return i*i fs.append(f) return fsf1, f2, f3 = count()pri...

2018-02-26 01:23:55 132

原创 linux挂载操作

开机自动挂载vi /etc/fstab这个文件保存着开机自动挂载的配置。 挂载的格式:<file system> <mount point> <type> <options> <dump> <pass>手动挂载 mountmount mount -t 文件系统 文件名 挂载点挂载光盘时,简单起见,可以直接mount /dev/sr0 挂载点。挂载U盘时,先查看设备文件名,一

2018-02-25 15:35:44 662

原创 linux压缩命令

zip压缩zip file.zip filezip -r file.zip directory解压unzip fiel.zipgz压缩gzip file #压缩之后删除源文件gzip -c file > file.gz #提取压缩结果到文件gzip -r dir #压缩目录下的子文件解压gzip -d file.gz #解压gunzip file.gz -c, –stdout

2018-02-23 03:01:45 810

原创 ubuntu开机启动

个人的修改位置Ubuntu有非常多的方式让程序开机自启,这里记录一下我的位置。vi /etc/rc.local内容大概如下:#!/bin/sh -e## rc.local## This script is executed at the end of each multiuser runlevel.# Make sure that the script will "exit 0" on s

2018-02-22 04:17:54 350

chromedriver_win32 2.38

Supports Chrome v65-67 Changes include: Fixed Chromedriver crash/lose connection when navigate to gmail Fixed unknown session ID and cannot determine loading status Resolved Chromedriver doesn't wait until iframe content loads after switching into iframe Fixed element is not clickable at point.

2018-04-24

chromedriver for linux 2.38

selenium chrome driver 2.38 Supports Chrome v65-67 Changes include: Fixed Chromedriver crash/lose connection when navigate to gmail Fixed unknown session ID and cannot determine loading status Resolved Chromedriver doesn't wait until iframe content loads after switching into iframe Fixed element is not clickable at point. 2018-04-21 22:31:09 3.60MB a658925aaa3cd79eed075533b576c636

2018-04-24

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

TA关注的人

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