- 博客(127)
- 资源 (8)
- 收藏
- 关注
原创 LeetCode 2. 两数相加
2. 两数相加难度中等5413收藏分享切换为英文接收动态反馈给出两个非空的链表用来表示两个非负的整数。其中,它们各自的位数是按照逆序的方式存储的,并且它们的每个节点只能存储一位数字。如果,我们将这两个数相加起来,则会返回一个新的链表来表示它们的和。您可以假设除了数字 0 之外,这两个数都不会以 0开头。示例:输入:(2 -> 4 -> 3) + (5 -> 6 -> 4)输出:7 -> 0 -> 8原因:342 + 465 = ...
2020-12-23 00:29:12
356
原创 nn.Embedding参数说明
CLASStorch.nn.Embedding(num_embeddings: int,embedding_dim: int,padding_idx: Optional[int] = None,max_norm: Optional[float] = None,norm_type: float = 2.0,scale_grad_by_freq: bool = False,sparse: bool = False,_weight: Optional[torch.Tensor] = None)[SO...
2020-10-23 10:15:56
5005
原创 POJ 3348 Cows 凸包
CowsTime Limit:2000MS Memory Limit:65536K Total Submissions:12101 Accepted:5243 DescriptionYour friend to the south is interested in building fences and turning plowshares ...
2019-07-11 16:47:42
1014
原创 CNN实现CIFAR 10 图像分类
get_data.pyimport torchimport torchvisionfrom torchvision import datasets, transformsfrom torch.utils.data import DataLoadertransform_train = transforms.Compose([ transforms.RandomCrop(3...
2019-04-17 12:33:35
1921
原创 树莓派搭建代理服务器(基于Squid)
第一步:https://blog.youkuaiyun.com/bql_email/article/details/79147250第二个:要使用Proxifier等软件sudo gedit /etc/squid/squid.conf在你几个SSL_ports后面一行添加 acl SSL_ports port 80第三个:配置 用户名和密码验证先安装mini-httpds...
2019-04-09 13:08:51
3756
原创 树莓派 selenium以及PyTorch环境搭建
selenium爬虫搭建:apt installchromium-browserapt install chromium-chromedriverpip3 install selenium获取Driver:from selenium import webdriverfrom selenium.webdriver.chrome.options import Optio...
2019-04-04 20:46:24
1179
原创 import rdkit 出现 ImportError: DLL load failed: 找不到指定的模块
import rdkit 出现 ImportError: DLL load failed: 找不到指定的模块:在pycharm里面调用Anaconda里面的解释器,出现以上错误,解决方法:将anaconda的Python版本必须为3.6的版本!!!...
2019-03-03 12:49:43
3070
转载 Python Conda 软件包升级
conda:以管理员身份启动Anaconda Prompt:升级conda(升级Anaconda前需要先升级conda):conda update conda升级anaconda:conda update anaconda升级spyder:conda update spyder更新所有包:conda update --all安装包:conda install package...
2019-03-03 00:44:51
25787
原创 为 windows cmd 设置代理
cmd如果要设置代理的话,需要在执行其他命令之前,先执行一下set http_proxy=http://127.0.0.1:1080set https_proxy=http://127.0.0.1:1080上面命令的作用是设置环境变量,不用担心,这种环境变量只会持续到cmd窗口关闭,不是系统环境变量。...
2019-03-02 22:48:22
6345
转载 pycharm 文件名颜色所代表的含义
绿色,已经加入版本控制暂未提交; 红色,未加入版本控制; 蓝色,加入版本控制,已提交,有改动; 白色,加入版本控制,已提交,无改动; 灰色:版本控制已忽略文件。...
2019-02-27 10:01:17
15894
2
原创 3. Longest Substring Without Repeating Characters --------- LeetCode
Given a string, find the length of the longest substring without repeating characters.Example 1:Input: "abcabcbb"Output: 3 Explanation: The answer is "abc", with the length of 3. Example 2:...
2019-02-26 22:05:32
143
原创 LeetCode 2. Add Two Numbers
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return i...
2019-02-26 20:43:08
130
原创 PyTorch RNN 输入维度,输出维度
batch_first = True输入:batch, seq_len, input_sizeh0:num_layers * num_directions, batch, hidden_size输出:batch,seq_len, num_directions * hidden_sizehn:num_layers * num_directions, batch, hidden_size...
2019-02-13 10:38:44
3614
原创 python 在List中随机抽取n个元素
choice(seq): 从seq序列中(可以是列表,元组,字符串)随机取一个元素返回choices(population, weights=None, *, cum_weights=None, k=1):从population中进行K次随机选取,每次选取一个元素(注意会出现同一个元素多次被选中的情况),weights是相对权重值,population中有几个元素就要有相对应的weights值...
2019-02-10 13:40:06
42608
1
原创 PyTorch 使用 RNN 输入sin(x)值序列,预测最后一个sin(x)对应的cos(x)
每一个sin(x)可能对应两个cos(x)的数值,不是一一对应关系,这边借助于RNN,输入sin(x)序列,预测sin(x)序列中最后一个值,对应的cos(x),借助的是RNN的记忆性。 这边要注意的是各个Tensor的维度的处理,熟悉torch.stack,torch.cat,x.squeeze(index), x.unsqueeze(index) 函数的使用import ...
2019-01-25 11:51:04
1308
3
原创 PyTorch 使用CNN实现MNIST手写字体识别
一个epoch下来,Test ACC: 0.9892import torchimport torch.nn as nnimport torchvisionfrom torchvision import datasets,transformsfrom torch.autograd import Variablefrom matplotlib import pyplot as plt...
2019-01-25 09:08:32
1340
原创 PyTorch Tensor拼接
torch.stack(sequence, dim=0, out=None),做tensor的拼接。sequence表示Tensor列表,dim表示拼接的维度,注意这个函数和concatenate是不同的,torch的concatenate函数是torch.cat,是在已有的维度上拼接,而stack是建立一个新的维度,然后再在该纬度上进行拼接。 torch.stacka ...
2019-01-25 00:21:00
3265
原创 PyTorch 使用RNN实现MNIST手写字体识别
此处使用普通的RNN推荐一个RNN入门资料:https://zhuanlan.zhihu.com/p/2805458928*28的图片,每个输入序列长度(seq_len)为28,每个输入的元素维度(input_size)为28,将一张图片的分为28列,为长度28的序列,序列中每个元素为28个元素(即每一列的像素)。注意,如果batch_first设置为1,则输出维度out: bat...
2019-01-24 23:50:36
4071
9
转载 ubuntu 18.04下解决网易云音乐需要root权限才能打开的问题
1、sudo gedit /etc/sudoers 在最后面加一行: 用户名 ALL = NOPASSWD: /usr/bin/netease-cloud-music 注:用户名为当前登录用户名 2、sudo gedit /usr/share/applications/netease-cloud-music.desktop 修改Exec=netease-cloud-music %U 为 Ex...
2019-01-24 16:37:29
778
2
转载 彻底关闭Pycharm拼写检查
1. Pycharm作为一款优秀的PythonIDE,唯一让我觉得不安的就是它的拼写检查机制实在有点严格,单词不能连写、变量名和函数名不能大写等等,网上百度了一下取消其拼写检查的方法,发现不是很全面,再次给大家奉上一个相对彻底的取消方法。 首先,关闭拼写检查,setting-->Inspections-->Spelling-->Typo,取消勾选: 第二步,关闭代码...
2019-01-23 17:48:53
3178
转载 pytorch RNN层api的几个参数说明(转载)
classtorch.nn.RNN(*args, **kwargs)input_size – The number of expected features in the input xhidden_size – The number of features in the hidden state hnum_layers – Number of recurrent layers. E....
2019-01-23 11:38:44
1691
原创 PyTorch 用全连接神经网络 实现MNIST数据集上面的手写数字识别
网络定义:文件net.pyimport torchfrom matplotlib import pyplot as plyfrom torch import nn, optimfrom torch.autograd import Variableclass simpleNet(nn.Module): """ Define Model """ def __in...
2018-11-24 15:18:12
2093
6
原创 PyTorch 实现 Logistic回归 逻辑回归
数据点随机产生(二维平面的点),下附产生训练数据的代码import numpy as npimport torchfrom matplotlib import pyplot as pltfrom torch import nn, optimfrom torch.autograd import Variabledata = np.load('data.npy')x = data[...
2018-11-21 23:40:16
1808
原创 PyTorch 多项式回归 线性模型 示例
PyTorch实现简单的多项式回归采用随机数进行训练import torchfrom torch import nn, optimfrom torch.autograd import Variablefrom matplotlib import pyplot as pltimport timeW_target = torch.FloatTensor([10, 20, 30])...
2018-11-21 16:34:20
543
原创 优先权队列使用示例 C++ STL
#include <iostream>#include <cstdio>#include <string>#include <sstream>#include <algorithm>#include <cstring>#include <map>#include <stack&
2018-09-11 11:23:24
245
原创 1002 A+B for Polynomials(25 分) PAT 甲级
1002 A+B for Polynomials(25 分)This time, you are supposed to find A+B where A and B are two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, an...
2018-09-10 22:10:27
254
原创 1001 A+B Format(20 分)
1001 A+B Format(20 分)Calculate a+b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits).Input Spec...
2018-09-10 21:25:46
284
原创 华中科技大学计算机历年考研复试上机题 (二叉排序树父亲节点)
题目描述二叉排序树,也称为二叉查找树。可以是一颗空树,也可以是一颗具有如下特性的非空二叉树: 1. 若左子树非空,则左子树上所有节点关键字值均不大于根节点的关键字值; 2. 若右子树非空,则右子树上所有节点关键字值均不小于根节点的关键字值; 3. 左、右子树本身也是一颗二叉排序树。 现在给你N个关键字值各不相同的节点,要求你按顺序插入一个初始为空树的二叉排序树中,每次插入后成功后,求相应的父亲...
2018-09-04 23:37:30
239
原创 A+B
题目描述给定两个整数A和B,其表示形式是:从个位开始,每三位数用逗号","隔开。 现在请计算A+B的结果,并以正常形式输出。输入描述:输入包含多组数据数据,每组数据占一行,由两个整数A和B组成(-10^9 < A,B < 10^9)。输出描述:请计算A+B的结果,并以正常形式输出,每组数据占一行。示例1输入复制-234,567,890 123,...
2018-09-04 23:16:14
227
原创 给出年分m和一年中的第n天,算出第n天是几月几号。
题目描述给出年分m和一年中的第n天,算出第n天是几月几号。输入描述:输入包括两个整数y(1<=y<=3000),n(1<=n<=366)。输出描述:可能有多组测试数据,对于每组数据,按 yyyy-mm-dd的格式将输入中对应的日期打印出来。示例1输入复制2000 32000 312000 402000 602000 61...
2018-09-04 23:08:47
2900
原创 输入一系列整数,建立二叉排序树,并进行前序,中序,后序遍历。
题目描述输入一系列整数,建立二叉排序树,并进行前序,中序,后序遍历。输入描述:输入第一行包括一个整数n(1<=n<=100)。接下来的一行包括n个整数。输出描述:可能有多组测试数据,对于每组数据,将题目所给数据建立一个二叉排序树,并对二叉排序树进行前序、中序和后序遍历。每种遍历结果输出一行。每行最后一个数据之后有一个空格。输入中可能有重复元素,但是输出的...
2018-09-04 22:49:07
12723
原创 对N个长度最长可达到1000的数进行排序。
题目描述对N个长度最长可达到1000的数进行排序。输入描述:输入第一行为一个整数N,(1<=N<=100)。接下来的N行每行有一个数,数的长度范围为1<=len<=1000。每个数都是一个正数,并且保证不包含前缀零。输出描述:可能有多组测试数据,对于每组数据,将给出的N个数从小到大进行排序,输出排序后的结果,每个数占一行。示例1输入复...
2018-09-04 18:00:51
1223
原创 N阶楼梯上楼问题
题目描述N阶楼梯上楼问题:一次可以走两阶或一阶,问有多少种上楼方式。(要求采用非递归)输入描述:输入包括一个整数N,(1<=N<90)。输出描述:可能有多组测试数据,对于每组数据,输出当楼梯阶数是N时的上楼方式个数。示例1输入复制4输出复制5第n阶台阶的方法等于上到第n-1阶台阶的方法加上第n-2阶的台阶的方法之和,因为...
2018-09-04 17:55:04
3345
原创 Windows下TensorFlow安装
1、安装ANACONDA2、配置TensorFlow环境:cmd下输入 conda create -n tensorflow python=3.63、打开ANACONDA prompt ,输入 activate tensorflow4、接着上一步,继续在ANACONDA prompt 里面输入:pip install --ignore-installed --upgrade htt...
2018-07-20 23:17:04
421
原创 Silver Cow Party(最短路+矩阵转置)
Silver Cow PartyTime Limit: 2000MS Memory Limit: 65536K Total Submissions: 27135 Accepted: 12393 DescriptionOne cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1....
2018-05-24 21:11:49
598
原创 Frogger POJ - 2253 (二分搜索+图的连通性判断)
FroggerTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 56014 Accepted: 17624 DescriptionFreddy Frog is sitting on a stone in the middle of a lake. Suddenly he notice...
2018-05-24 20:32:42
447
原创 Til the Cows Come Home (dijstra单源最短路)
Til the Cows Come HomeTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 68738 Accepted: 23048 DescriptionBessie is out in the field and wants to get back to the barn t...
2018-05-24 19:48:56
193
原创 Catch That Cow POJ - 3278 BFS搜索
Catch That CowTime Limit: 2000MS Memory Limit: 65536K Total Submissions: 112355 Accepted: 35099 DescriptionFarmer John has been informed of the location of a fugitive cow and w...
2018-05-24 16:46:03
172
原创 Dungeon Master POJ - 2251
Dungeon MasterTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 45231 Accepted: 17070 DescriptionYou are trapped in a 3D dungeon and need to find the quickest way out!...
2018-05-24 16:08:35
187
夜间智能定时关机
2013-02-04
15 个一定要会的 Windows7 快捷键
2013-02-04
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人