• 等级
  • 3081 访问
  • 91 原创
  • 1 转发
  • 75361 排名
  • 2 评论
  • 1 获赞

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(input...

2019-04-22 16:57:33

numpy与torch

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

2019-04-20 21:04:54

linux下运行Windows下写的bash脚本

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

2019-04-09 14:42:50

conda环境中关于tensorflow的报错

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

2019-04-08 13:12:31

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

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

2018-12-19 21:25:29

LeetCode-Product_of_Array_Except_Self

题目:Givenanarray nums of n integerswhere n >1, returnanarray output suchthat output[i] isequaltotheproductofalltheelementsof nums except nums[i].Example:Input:[1,2,3,4]Out...

2018-09-21 16:14:10

LeetCode-Palindromic_Substrings

题目:Givenastring,yourtaskistocounthowmanypalindromicsubstringsinthisstring.Thesubstringswithdifferentstartindexesorendindexesarecountedasdifferentsubstringseventheycon...

2018-08-11 16:30:03

LeetCode-Queue_Reconstruction_by_Height

题目:Supposeyouhavearandomlistofpeoplestandinginaqueue.Eachpersonisdescribedbyapairofintegers (h,k),where h istheheightofthepersonand k isthenumberofpeopleinfrontof...

2018-08-11 15:04:05

LeetCode-Counting_Bits

题目:Givenanonnegativeintegernumber num.Foreverynumbers i intherange 0≤i≤num calculatethenumberof1'sintheirbinaryrepresentationandreturnthemasanarray.Example1:Input:...

2018-08-11 10:53:39

LeetCode-Merge_Two_Binary_Trees

题目:Giventwobinarytreesandimaginethatwhenyouputoneofthemtocovertheother,somenodesofthetwotreesareoverlappedwhiletheothersarenot.Youneedtomergethemintoanewbinary...

2018-08-11 09:51:00

LeetCode-Student_Attendance_Record_I

题目:Youaregivenastringrepresentinganattendancerecordforastudent.Therecordonlycontainsthefollowingthreecharacters:'A' :Absent. 'L' :Late. 'P' :Present.Astudentcouldberew...

2018-07-25 08:50:16

LeetCode-Diameter_of_Binary_Tree

题目:Givenabinarytree,youneedtocomputethelengthofthediameterofthetree.Thediameterofabinarytreeisthelengthofthelongestpathbetweenanytwonodesinatree.Thispathmayor...

2018-07-24 09:00:56

LeetCode-Reverse_Words_in_a_String_III

题目:Givenastring,youneedtoreversetheorderofcharactersineachwordwithinasentencewhilestillpreservingwhitespaceandinitialwordorder.Example1:Input:"Let'stakeLeetCodecontest"Ou...

2018-06-29 09:52:30

C++小技巧

1.利用istringstream将字符串按空格分隔#include<sstream>strings="abcdefg";stringt="";istringstreamis(s);while(s>>t)cout<<t;//t分别为a,b,cd,efg2.string.pop_back() 删除字符串的最后一个字符string...

2018-06-29 09:47:40

LeetCode-Reverse_String_II

题目:Givenastringandanintegerk,youneedtoreversethefirstkcharactersforevery2kcharacterscountingfromthestartofthestring.Iftherearelessthankcharactersleft,reversealloft...

2018-06-29 09:13:03

LeetCode-Convert_BST_To_Greater_Tree

题目:GivenaBinarySearchTree(BST),convertittoaGreaterTreesuchthateverykeyoftheoriginalBSTischangedtotheoriginalkeyplussumofallkeysgreaterthantheoriginalkeyinBST.Examp...

2018-06-28 10:05:21

LeetCode-K-diff_Pairs_in_an_Array

题目:Givenanarrayofintegersandaninteger k,youneedtofindthenumberof unique k-diffpairsinthearray.Herea k-diff pairisdefinedasanintegerpair(i,j),where i and j arebothnumbers...

2018-06-28 09:11:52

LeetCode-Array_Partition_I

题目:Givenanarrayof 2n integers,yourtaskistogrouptheseintegersinto n pairsofinteger,say(a1,b1),(a2,b2),...,(an,bn)whichmakessumofmin(ai,bi)forallifrom1tonaslargeasp...

2018-06-27 10:19:37

LeetCode-Minimum_Absolute_Difference_in_BST

题目:Givenabinarysearchtreewithnon-negativevalues,findtheminimum absolutedifference betweenvaluesofanytwonodes.Example:Input:1\3/2Output:1Explanation:Them...

2018-06-27 10:00:49

LeetCode-Longest_Uncommon_Subsequence_I

题目:Givenagroupoftwostrings,youneedtofindthelongestuncommonsubsequenceofthisgroupoftwostrings.Thelongestuncommonsubsequenceisdefinedasthelongestsubsequenceofoneofthese...

2018-06-26 19:01:53

_TX

关注
  • 中国