自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 C++ vector

vector 是C++ STL的一个重要成员,使用它时需要包含头文件:#include<vector>;一、vector 的初始化:可以有五种方式,举例说明如下: (1) vector<int> a(10); //定义了10个整型元素的向量(尖括号中为元素类型名,它可以是任何合法的数据类型),但没有给出初值,其值是不确定的。 (2)vector<...

2019-11-27 21:39:44 73

转载 全连接层的理解

全连接层的推导全连接层的每一个结点都与上一层的所有结点相连,用来把前边提取到的特征综合起来。由于其全相连的特性,一般全连接层的参数也是最多的。全连接层的前向计算下图中连线最密集的2个地方就是全连接层,这很明显的可以看出全连接层的参数的确很多。在前向计算过程,也就是一个线性的加权求和的过程,全连接层的每一个输出都可以看成前一层的每一个结点乘以一个权重系数W,最后加上一个偏置值b得到,即 ...

2019-04-28 10:02:34 655

原创 python 类的继承 类的多态 子类重写构造函数 多重继承

1 类的继承在面向对象程序设计中,当我们定义一个class的时候,可以从某个现有的class继承,新的class称为子类(Subclass),而被继承的class称为基类、父类。如下代码中,父类为Person ,子类为Childclass Person(object): def __init__(self,name,sex): self.name = name...

2019-04-25 22:34:12 605

原创 AssertionError: size of input tensor and input format are different

在调试pytorch-faster-rcnn中遇到的问题:出现以下问题(1) File "/usr/local/lib/python2.7/site-packages/PIL/Image.py", line 1884, in fromarrayraise TypeError("Cannot handle this data type")TypeError: Cannot handle th...

2019-04-22 17:51:36 2363 2

原创 解决“Some index files failed to download, they have been ignored, or old ones used instead.”

网上的 sudo rm /var/lib/apt/lists/* -vf和sudo apt-get update 不能解决我的问题:下面是我的问题解决的方法:sudo rm -rf /var/lib/apt/lists/*sudo apt-get remove .*:arm64sudo dpkg --remove-architecture arm64之后再sudo apt-ge...

2019-04-19 09:58:36 2532

转载 caffe 当前程序Python路径

运行caffe代码时,Python路径的问题,查看当前路径和修改路径的方法。实际是python接口的路径不对,使用echo $PYTHONPATH  弹出当前python路径,发现是caffe自己的python接口,采用 export PYTHONPATH=/home/用户名/(当前要用的Python路径)/python即可,最后可用echo $PYTHONPATH查询当前python路径,示...

2018-11-09 11:32:27 1314

原创 ubuntu 14.04安裝tensorflow-gpu

 记录一下本次安装tensorflow的流程.因为之前已将安装过caffe框架,所以已经安装CUDA 8.0 ,Nvidia cuDNN等前提环境.只需要在这个基础上安装tensorflow采用的是anaconda3,tensorflow-gpu==1.2.0,安装Anaconda3:Anaconda可以省去很多麻烦,建议采用这种方式; 从清华大学开源软件镜像站下载想的版本;...

2018-09-13 16:59:28 135

原创 Best Time to Buy and Sell Stock

Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (i.e., buy one and sell one share of the stock), d...

2018-06-05 11:17:32 87

原创 Move Zeroes

Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.example:Input: [0,1,0,3,12]Output: [1,3,12,0,0]class Solution(objec...

2018-06-04 21:57:19 56

原创 两个二进数相加返回一个十进制数/exercise code 12

Given two binary strings, return their sum (also a binary string).The input strings are both non-empty and contains only characters 1 or 0.Example 1:Input: a = "11", b = "1"   Output: "100"Example 2:I...

2018-06-04 20:49:55 158

原创 Rotate Array

Given an array, rotate the array to the right by k steps, where k is non-negative.example:Input: [1,2,3,4,5,6,7] and k = 3Output: [5,6,7,1,2,3,4]Explanation:rotate 1 steps to the right: [7,1,2,3,4,5,6...

2018-06-04 20:48:41 102

原创 Two Sum II - Input array is sorted--exercise code17

Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers su...

2018-05-27 16:45:24 85

原创 Pascal's Triangle II--exercise code16

title:Given a non-negative index k where k ≤ 33, return the kth index row of the Pascal's triangle.Note that the row index starts from 0.Input: 3Output: [1,3,3,1]code:class Solution(object):    d...

2018-05-26 22:10:39 89

原创 Same Tree--exercise code16

判断两个二叉树是否相同Given two binary trees, write a function to check if they are the same or not.Two binary trees are considered the same if they are structurally identical and the nodes have the same value.E...

2018-05-24 16:48:32 90

原创 Merge Sorted Array

Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:The number of elements initialized in nums1 and nums2 are m and n respectively.You may assume that nums...

2018-05-22 16:53:05 51

原创 Remove Duplicates from Sorted List--exercise code 15

Example 1:Input: 1-&gt;1-&gt;2   Output: 1-&gt;2Example 2:Input: 1-&gt;1-&gt;2-&gt;3-&gt;3    Output: 1-&gt;2-&gt;3class Solution(object):    def deleteDuplicates(self, head):        """        :type ...

2018-05-21 20:46:17 70

原创 Climbing Stairs---exercise code 13

题目翻译:你在爬楼梯。需要n步到达顶端。每次可以爬上1或2级。有多少种不同的方式到达顶端?分析:        f(n)=f(n-1)+f(n-2)。自底向上。爬楼梯问题。经典的动态规划问题。每次上一个台阶或者两个台阶,问一共有多少种方法到楼顶。这个实际上就是斐波那契数列的求解。可以逆向来分析问题,如果有n个台阶,那么走完n个台阶的方式有f(n)种。而走完n个台阶有两种方法,先走完n-2个台阶,然...

2018-05-21 18:13:36 66

原创 Plus One/ code 13

Given a non-empty array of digits representing a non-negative integer, plus one to the integer.The digits are stored such that the most significant digit is at the head of the list, and each element i...

2018-05-14 20:01:30 71

原创 Length of Last Word/exercise code 12

Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word does not exist, return 0.Note: A word is defined a...

2018-05-14 17:23:49 54

转载 Python内置的字符串处理函数整理

字母处理全部大写:str.upper()全部小写:str.lower()大小写互换:str.swapcase()首字母大写,其余小写:str.capitalize()首字母大写:str.title()print '%s lower=%s' % (str,str.lower())print '%s upper=%s' % (str,str.upper())print '%s swapcase=%s'...

2018-05-14 16:42:05 202

原创 Maximum Subarray/code 11

Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.Example:Input: [-2,1,-3,4,-1,2,1,-5,4],Output: 6Explanation: [4,...

2018-05-13 20:20:32 73

原创 Search Insert Position /code 10

Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.Exam...

2018-05-13 16:42:20 64

原创 exercise code 9

Implement strStr().Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Example 1:Input: haystack = "hello", needle = "ll"    Output: 2Example 2:Inpu...

2018-05-10 16:16:07 57

原创 exercise code 8

Remove Elementclass Solution(object):    def removeElement(self, nums, val):        """        :type nums: List[int]        :type val: int        :rtype: int        """        while val in nums:      ...

2018-05-09 16:48:27 94

原创 excrcise code 7

在已经排过序的数组中,统计数字中不重复数字的个数code:class Solution(object):         def removeDuplicates(self, nums):        """        :type nums: List[int]        :rtype: int        """        if not nums:            retu...

2018-05-09 16:39:27 159

原创 excrcise code 4-6

code 4 判断数字是否是回文数例:Input: 121    Output: tru      Input: -121   Output: false     Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome....

2018-05-05 15:51:27 113

原创 code exercise 1-3

code 1Given nums = [2, 7, 11, 15], target = 9,Because nums[0] + nums[1] = 2 + 7 = 9,return [0, 1].code:nums=[2,7,5,8]target=12buff_dict={}for i in range(len(nums)):    print(i)    if nums[i] in buf...

2018-05-02 17:25:42 109

空空如也

空空如也

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

TA关注的人

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