随笔 - 165,  文章 - 0,  评论 - 4,  阅读 - 17887
07 2023 档案
剑指 Offer 59 - II. 队列的最大值(中等)
摘要:题目: class MaxQueue { public: deque<int> que1; //使用两个双端队列(deque和queue不一样,用deque就行) deque<int> que2; MaxQueue() { } int max_value() { return que2.empty( 阅读全文
posted @ 2023-07-31 22:40 孜孜不倦fly 阅读(14) 评论(0) 推荐(0) 编辑
剑指 Offer 30. 包含min函数的栈(简单)
摘要:题目: ![](https://img2023.cnblogs.com/blog/2679751/202307/2679751-20230731211502474-1179914637.png) ``` class MinStack { public: stack st1; //维护原栈 stack 阅读全文
posted @ 2023-07-31 21:26 孜孜不倦fly 阅读(1) 评论(0) 推荐(0) 编辑
python数据切片特点
摘要:1.python的数据用[ ]选择数据下标 2.python的下标从0开始 3.python的数据切片是“左闭右开的”,例如:python中写a[0:5],实际上是取a中下标为“0-4”的元素,即实际中的第1~5个元素。 阅读全文
posted @ 2023-07-31 11:39 孜孜不倦fly 阅读(14) 评论(0) 推荐(0) 编辑
剑指 Offer 59 - I. 滑动窗口的最大值(困难)
摘要:题目: ![](https://img2023.cnblogs.com/blog/2679751/202307/2679751-20230728211600053-1162793060.png) ``` class Solution { public: vector maxSlidingWindow 阅读全文
posted @ 2023-07-28 21:25 孜孜不倦fly 阅读(5) 评论(0) 推荐(0) 编辑
使用nn.Conv2d()和nn.MaxPool2d()调整输出的技巧
摘要:前提是没有使用dilation,牢记以下公式: ![](https://img2023.cnblogs.com/blog/2679751/202307/2679751-20230728153345656-868602173.png) 1.如果想保持张量大小不变,则:kenel_size=3(奇数), 阅读全文
posted @ 2023-07-28 15:37 孜孜不倦fly 阅读(95) 评论(0) 推荐(0) 编辑
剑指 Offer 09. 用两个栈实现队列(简单)
摘要:题目: ![](https://img2023.cnblogs.com/blog/2679751/202307/2679751-20230727205808737-1880467450.png) ``` class CQueue { public: stack st1; stack st2; CQu 阅读全文
posted @ 2023-07-27 21:03 孜孜不倦fly 阅读(4) 评论(0) 推荐(0) 编辑
剑指 Offer 79 - I. 翻转单词顺序(简单)(简单个屁!)
摘要:题目: class Solution { public: string reverseWords(string s) { //该方法利用递归栈的逆序将单词逆序 string word; //保存一个完整的单词 if(s.empty()) return word; //终止条件,即最后一次递归会收到空 阅读全文
posted @ 2023-07-27 20:04 孜孜不倦fly 阅读(4) 评论(0) 推荐(0) 编辑
nn.MaxPool2d()、transpose().contiguous()、view()说明
摘要:**1.nn.MaxPool2d()** 和nn.Conv2D()基本一样,但是stride默认值是kernel_size。 **2.transpose().contiguous()、view()** contiguous一般与transpose,permute,view搭配使用:使用transpo 阅读全文
posted @ 2023-07-26 22:35 孜孜不倦fly 阅读(51) 评论(0) 推荐(0) 编辑
剑指 Offer 57. 和为s的两个数字(简单)
摘要:题目: ![](https://img2023.cnblogs.com/blog/2679751/202307/2679751-20230726212413650-1751800137.png) ``` class Solution { public: vector twoSum(vector& n 阅读全文
posted @ 2023-07-26 21:27 孜孜不倦fly 阅读(4) 评论(0) 推荐(0) 编辑
剑指 Offer 21. 调整数组顺序使奇数位于偶数前面(简单)
摘要:题目: class Solution { public: vector<int> exchange(vector<int>& nums) { for(int i=0,j=nums.size()-1;i<j;i++){ if(nums[i]%2==0){ //从i前开始,遇到偶数开始处理 while( 阅读全文
posted @ 2023-07-26 20:20 孜孜不倦fly 阅读(1) 评论(0) 推荐(0) 编辑
nn.Conv2d()参数说明、输入输出
摘要:**1.参数说明** ![](https://img2023.cnblogs.com/blog/2679751/202307/2679751-20230726163601352-1798700721.png) **2.输入输出参数计算** ![](https://img2023.cnblogs.co 阅读全文
posted @ 2023-07-26 16:37 孜孜不倦fly 阅读(313) 评论(0) 推荐(0) 编辑
剑指 Offer 52. 两个链表的第一个公共节点(简单)
摘要:题目: ![](https://img2023.cnblogs.com/blog/2679751/202307/2679751-20230725211140580-1927197142.png) ``` class Solution { public: ListNode *getIntersecti 阅读全文
posted @ 2023-07-25 21:15 孜孜不倦fly 阅读(5) 评论(0) 推荐(0) 编辑
剑指 Offer 25. 合并两个排序的链表(简单)
摘要:题目: ![](https://img2023.cnblogs.com/blog/2679751/202307/2679751-20230725204245654-102928942.png) ``` class Solution { public: ListNode* mergeTwoLists( 阅读全文
posted @ 2023-07-25 20:48 孜孜不倦fly 阅读(3) 评论(0) 推荐(0) 编辑
剑指 Offer 35. 复杂链表的复制(中等)
摘要:题目: ![](https://img2023.cnblogs.com/blog/2679751/202307/2679751-20230721220032732-1493734355.png) ``` /* // Definition for a Node. class Node { public 阅读全文
posted @ 2023-07-21 22:11 孜孜不倦fly 阅读(2) 评论(0) 推荐(0) 编辑
剑指 Offer 22. 链表中倒数第k个节点(简单)
摘要:题目: ![](https://img2023.cnblogs.com/blog/2679751/202307/2679751-20230721210427123-1164881823.png) ``` /** * Definition for singly-linked list. * struc 阅读全文
posted @ 2023-07-21 21:06 孜孜不倦fly 阅读(2) 评论(0) 推荐(0) 编辑
剑指 Offer 18. 删除链表的节点
摘要:题目:(有改动和陷阱,不可以使用delete否则报错!!) ![](https://img2023.cnblogs.com/blog/2679751/202307/2679751-20230720221902999-880856281.png) ``` class Solution { public 阅读全文
posted @ 2023-07-20 22:23 孜孜不倦fly 阅读(2) 评论(0) 推荐(0) 编辑
剑指 Offer 24. 反转链表(简单)
摘要:题目: ![](https://img2023.cnblogs.com/blog/2679751/202307/2679751-20230720212411915-721741165.png) ``` /** * Definition for singly-linked list. * struct 阅读全文
posted @ 2023-07-20 21:28 孜孜不倦fly 阅读(2) 评论(0) 推荐(0) 编辑
剑指 Offer 06. 从尾到头打印链表(简单)
摘要:题目: ![](https://img2023.cnblogs.com/blog/2679751/202307/2679751-20230720202030650-1945110898.png) ``` /** * Definition for singly-linked list. * struc 阅读全文
posted @ 2023-07-20 20:22 孜孜不倦fly 阅读(3) 评论(0) 推荐(0) 编辑
获取模型的参数量和计算复杂度
摘要:``` import torch import net.bilstm import net.transformer from ptflops import get_model_complexity_info device = torch.device("cuda:0" if torch.cuda.i 阅读全文
posted @ 2023-07-20 16:58 孜孜不倦fly 阅读(147) 评论(0) 推荐(0) 编辑
解决在VM虚拟机中ubuntu系统无法从本机复制粘贴的问题
摘要:推荐使用: ``` sudo apt-get install open-vm-tools-desktop sudo reboot ``` **不推荐自带的安装vmware-tools的方法!** 阅读全文
posted @ 2023-07-20 14:57 孜孜不倦fly 阅读(84) 评论(0) 推荐(0) 编辑
剑指 Offer 67. 把字符串转换成整数(中等)
摘要:题目 ![](https://img2023.cnblogs.com/blog/2679751/202307/2679751-20230719221809046-913002306.png) ``` class Solution { public: int strToInt(string str) 阅读全文
posted @ 2023-07-19 22:24 孜孜不倦fly 阅读(5) 评论(0) 推荐(0) 编辑
剑指 Offer 20. 表示数值的字符串(中等)
摘要:题目: //遇到数字:一定合法 //遇到'.'且合法需要满足条件:之前没出现过'.',之前没出现过'e' //遇到'e'且合法需要满足条件:之前没出现过'e',之前出现过整数 //遇到'+'或者'-'且合法需要满足条件:位于字符串第一位,或者紧跟在'e'之后 class Solution { pub 阅读全文
posted @ 2023-07-19 20:56 孜孜不倦fly 阅读(17) 评论(0) 推荐(0) 编辑
剑指 Offer 58 - II. 左旋转字符串(简单)
摘要:题目: ![](https://img2023.cnblogs.com/blog/2679751/202307/2679751-20230719210019388-233593408.png) ``` class Solution { public: string reverseLeftWords( 阅读全文
posted @ 2023-07-18 20:47 孜孜不倦fly 阅读(4) 评论(0) 推荐(0) 编辑
剑指 Offer 05. 替换空格(简单)
摘要:题目: ![](https://img2023.cnblogs.com/blog/2679751/202307/2679751-20230719205939606-1117824637.png) ``` class Solution { public: string replaceSpace(str 阅读全文
posted @ 2023-07-18 20:38 孜孜不倦fly 阅读(6) 评论(0) 推荐(0) 编辑
二叉排序树删除节点
摘要:**前驱替换法** 用被删除节点左子树最右边的节点的值来替换被删除节点 ![](https://img2023.cnblogs.com/blog/2679751/202307/2679751-20230717153623469-344447763.png) 上图删除了节点11 阅读全文
posted @ 2023-07-17 15:36 孜孜不倦fly 阅读(13) 评论(0) 推荐(0) 编辑
C++中的三种继承(public, protected, private)
摘要:**权限只取决于低的那个权限** 1.子类通过public方式继承父类,则父类中的**public、protected、private**属性的成员在子类中依次是 public、protected和private 性,即通过public继承并不会改变父类原来的数据属性。 2.子类通过**protec 阅读全文
posted @ 2023-07-14 16:31 孜孜不倦fly 阅读(247) 评论(0) 推荐(0) 编辑
使用git报错:fatal: unable to access 'https://github.com/flysmart/Accounting.git/': Failed to connect to github.com port 443 after 21061 ms: Couldn't connect to server报错
摘要:1.在git中执行: ``` git config --global --unset http.proxy git config --global --unset https.proxy ``` 2.在电脑上cmd中执行 ``` ipconfig/flushdns ``` 问题解决!(个人出现该问题 阅读全文
posted @ 2023-07-13 11:14 孜孜不倦fly 阅读(160) 评论(0) 推荐(0) 编辑
一些报错以及解决办法_1
摘要:**1.**报错信息:TYPEERROR: MAX() RECEIVED AN INVALID COMBINATION OF ARGUMENTS - GOT (AXIS=INT, OUT=NONETYPE, ), BUT EXPECTED ONE OF: 报错代码为: ``` def f1_over 阅读全文
posted @ 2023-07-05 20:02 孜孜不倦fly 阅读(430) 评论(0) 推荐(0) 编辑
调整网络中参数的形状
摘要:1.首先阅读数据预处理的代码,确定送入神经网络的输入x的张量形状。比如现在有个语音输入特征张量x形状为[16, 1, 256, 40],【批量,通道数,像素宽度,特征维度】。 如果看不懂,可以先在网络的forward最开始进行print(x.shape)打印。 2.常见改变张量形状的方法: (1) 阅读全文
posted @ 2023-07-05 11:56 孜孜不倦fly 阅读(29) 评论(0) 推荐(0) 编辑


< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示