自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

TanX的博客

逼自己优秀,然后骄傲的生活

  • 博客(100)
  • 收藏
  • 关注

原创 Typescript和Node.js

Node.js 读写文件。

2023-06-08 16:27:09 77

原创 实用小技巧

将 josnl 文件转到 json 文件。

2023-06-08 16:17:08 57

原创 内存,显存

电脑内存是替CPU暂存资料的储存空间。htop 下 memory即为整个即的内存大小。以下图机器为例,该机器的内存大小为755G。显卡显存是替GPU(显卡芯片)暂存资料的储存空间。nvidia-smi 下 节点数*每个节点的memory即为整个机器的显存大小。以下图机器为例,该机器的显存大小为32480*4。...

2021-09-19 10:34:42 233

原创 Pytorch报错:cuDNN error: CUDNN_STATUS_EXECUTION_FAILED

如果你遇到了这个错误 RuntimeError: cuDNN error: CUDNN_STATUS_EXECUTION_FAILED,1. 首先确保所有版本都是匹配的,那么出现这个问题可能是因为你直接用pip install torch 指令了。2. 那么,尝试用官网上的指令(Pytorch官网找到合适的pytorch版本)重新安装pytorch,如下:conda install pytorch torchvision cudatoolkit=10.0 -c pytorch...

2021-04-01 10:30:28 1083

原创 快速排序

具体算法参考:https://zhuanlan.zhihu.com/p/93129029代码:#!/usr/bin/python# -*- coding: UTF-8 -*-def QuickSort(a, low, high): i = low j = high if (i < j): temp = a[i] while (i != j): while (j > i and a[j] >.

2021-03-31 17:11:10 102

原创 ipython notebook

最近在别人的代码中看到了.ipynb文件,这里介绍一下基本的使用。1. cmd进入.ipynb文件所在的目录或其所在工程的目录下,键入命令jupyter notebook;2. 这时会弹出一个页面;3. 点开.ipynb文件即可。在这个页面中可以直接运行代码。...

2021-03-18 14:07:11 222

原创 WordNet学习整理

安装:import nltknltk.download('wordnet')使用:from nltk.corpus import wordnet as wn1.查询一个词所在的所有词集(synsets)>>>wn.synsets('dog') # 可以添加pos属性,pos值可以为——NOUN,VERB,ADJ,ADV… 如pos=wn.NOUN[Synset('dog.n.01'), Synset('frump.n.01'),Synset('frank...

2021-03-04 15:08:57 187 1

原创 解决pyrouge报错

首先,下载ROUGE-1.5.5包,git clonehttps://github.com/andersjo/pyrouge;其次,安装pyrouge环境:pip uninstall pyrougegit clone https://github.com/bheinzerling/pyrougecd pyrougepip install -e .pyrouge_set_rouge_path </absolute/path/to/ROUGE-1.5.5/directory&g...

2020-10-27 09:00:50 350

原创 tensorflow与pytorch

tensorflow中与pytorch同等作用的函数:tf.reshape(input, shape) -> input.view(shape)tf.minium(input, min) -> torch.clamp(input, max)tf.gather(input1, input2) -> input1[input2]tf.expand_dims(in...

2019-04-22 16:57:33 1873

原创 numpy与torch

numpy类型转torch类型:torch.from_numpy()

2019-04-20 21:04:54 428

原创 linux下运行Windows下写的bash脚本

运行bash脚本出现了$'\r': command not found问题系windos和linux的换行符差异,解决方案:用vim打开bash脚本,esc模式下set ff=unix,保存后重新运行就不会报错了。...

2019-04-09 14:42:50 320

原创 conda环境中关于tensorflow的报错

由于conda环境中的tensorflow缺乏absl包,引发如上所示报错,解决方案:conda install absl-py

2019-04-08 13:12:31 796

转载 转载:Linux打开txt文件乱码的解决方法

今天发现打开windows下的txt文本出现问题,主要是编码问题,所以这里我记录下这个问题的解决方法。 Linux显示在Windows编辑过的中文就会显示乱码是由于两个操作系统使用的编码不同所致。Linux下使用的编码是utf8,而Windows使用的是gb18030。因此,解决Linux打开txt文件中文乱码可有如下两种方法。  方法一:  在附件终端中,进入到txt文件所在目录,使...

2018-12-19 21:25:29 1428 1

原创 LeetCode-Product_of_Array_Except_Self

题目:Given an array nums of n integers where n &gt; 1,  return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Example:Input: [1,2,3,4]Out...

2018-09-21 16:14:10 166

原创 LeetCode-Palindromic_Substrings

题目:Given a string, your task is to count how many palindromic substrings in this string.The substrings with different start indexes or end indexes are counted as different substrings even they con...

2018-08-11 16:30:03 160

原创 LeetCode-Queue_Reconstruction_by_Height

题目:Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the person and k is the number of people in front of ...

2018-08-11 15:04:05 150

原创 LeetCode-Counting_Bits

题目:Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array.Example 1:Input: ...

2018-08-11 10:53:39 138

原创 LeetCode-Merge_Two_Binary_Trees

题目:Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.You need to merge them into a new binary...

2018-08-11 09:51:00 190

原创 LeetCode-Student_Attendance_Record_I

题目:You are given a string representing an attendance record for a student. The record only contains the following three characters:'A' : Absent. 'L' : Late. 'P' : Present.A student could be rew...

2018-07-25 08:50:16 185

原创 LeetCode-Diameter_of_Binary_Tree

题目:Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path between any two nodes in a tree. This path may or ...

2018-07-24 09:00:56 157

原创 LeetCode-Reverse_Words_in_a_String_III

题目:Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.Example 1:Input: "Let's take LeetCode contest"Ou...

2018-06-29 09:52:30 174

原创 C++小技巧

1.利用istringstream将字符串按空格分隔#include&lt;sstream&gt;string s="a b cd efg";string t="";istringstream is(s);while(s&gt;&gt;t) cout&lt;&lt;t; //t分别为a,b,cd,efg2.string.pop_back()  删除字符串的最后一个字符string...

2018-06-29 09:47:40 248

原创 LeetCode-Reverse_String_II

题目:Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there are less than k characters left, reverse all of t...

2018-06-29 09:13:03 148

原创 LeetCode-Convert_BST_To_Greater_Tree

题目:Given 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 BST.Examp...

2018-06-28 10:05:21 162

原创 LeetCode-K-diff_Pairs_in_an_Array

题目:Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an integer pair (i, j), where i and j are both numbers...

2018-06-28 09:11:52 135

原创 LeetCode-Array_Partition_I

题目:Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as p...

2018-06-27 10:19:37 146

原创 LeetCode-Minimum_Absolute_Difference_in_BST

题目:Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes.Example:Input: 1 \ 3 / 2Output:1Explanation:The m...

2018-06-27 10:00:49 107

原创 LeetCode-Longest_Uncommon_Subsequence_I

题目:Given a group of two strings, you need to find the longest uncommon subsequence of this group of two strings. The longest uncommon subsequence is defined as the longest subsequence of one of these ...

2018-06-26 19:01:53 166

原创 LeetCode-Detect_Capital

题目:Given a word, you need to judge whether the usage of capitals in it is right or not.We define the usage of capitals in a word to be right when one of the following cases holds:All letters in this w...

2018-06-26 14:26:26 154

原创 LeetCode-Perfect_Number

题目:We define the Perfect Number is a positive integer that is equal to the sum of all its positive divisors except itself.Now, given an integer n, write a function that returns true when it is a perfe...

2018-06-25 15:24:11 142

原创 LeetCode-Relative_Ranks

题目:Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: "Gold Medal", "Silver Medal" and "Bronze Medal".Example 1:Input: ...

2018-06-25 14:49:17 164

原创 LeetCode-Base_7

题目:Given an integer, return its base 7 string representation.Example 1:Input: 100Output: "202"Example 2:Input: -7Output: "-10"Note: The input will be in range of [-1e7, 1e7].翻译:给定一个数字,返回它的7进制字符串表示...

2018-06-21 10:19:33 135

原创 LeetCode-Find_Mode_in_Binary_Search_Tree

题目:Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given BST.Assume a BST is defined as follows:The left subtree of a node contains...

2018-06-20 12:54:00 106

原创 LeetCode-Keyboard_Row

题目:Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below.Example 1:Input: ["Hello", "Alaska", "Dad", "Peace"]...

2018-06-20 09:22:35 147

原创 LeetCode-Next_Greater_Element_I

题目:You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1's elements in the corresponding places of nums2...

2018-06-13 10:17:42 124

原创 LeetCode-Construct_the_Rectangle

题目:For a web developer, it is very important to know how to design a web page's size. So, given a specific rectangular web page’s area, your job by now is to design a rectangular web page, whose lengt...

2018-06-12 10:52:28 112

原创 LeetCode-Max_Consecutive_Ones

题目:Given a binary array, find the maximum number of consecutive 1s in this array.Example 1:Input: [1,1,0,1,1,1]Output: 3Explanation: The first two digits or the last three digits are consecutive 1s....

2018-06-04 10:03:54 246

原创 LeetCode-License_Key_Formatting

题目:You are given a license key represented as a string S which consists only alphanumeric character and dashes. The string is separated into N+1 groups by N dashes.Given a number K, we would want to r...

2018-06-04 09:39:33 307

原创 LeetCode-Largest_Palindrome_Product

题目:Find the largest palindrome made from the product of two n-digit numbers.Since the result could be very large, you should return the largest palindrome mod 1337.Example:Input: 2Output: 987Explanati...

2018-06-02 10:52:16 189 1

原创 LeetCode-Number_Complement

题目:Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.Note:The given integer is guaranteed to fit within the range of a 32...

2018-05-27 18:15:11 142

空空如也

空空如也

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

TA关注的人

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