当前位置: 首页 > news >正文

C++笔记(体系结构与内核分析)

1.OOP面向对象编程 vs. GP泛型编程

  • OOP将data和method放在一起,目的是通过封装、继承、多态提高软件的可维护性和可扩展性
  • GP将data和method分开,可以将任何容器与任何算法结合使用,只要容器满足塞饭所需的迭代器类型

2.算法与仿函数的区别

bool strLonger(const string &s1, const string &s2)
{return s1.size() < s2.size();
}// 算法
cout << "max of zoo and hello:" << max(string("zoo"), string("hello")) << endl;
// 仿函数
cout << "max of zoo and hello:" << max(string("zoo"), string("hello"), strLonger) << endl;

3.泛化、特化、偏特化

  • 泛化:支持广泛的数据类型和情况,而不是针对特定类型
  • 特化:为特定类型或一组类型提供特定的实现
#include <iostream>// General template
template <typename T>
void print(T arg) {std::cout << "General print: " << arg << std::endl;
}// Specialization for const char*
template <>
void print<const char*>(const char* arg) {std::cout << "Specialized print for const char*: " << arg << std::endl;
}int main() {print(123);             // Uses general templateprint("Hello, world");  // Uses specialized template
}
  • 偏特化:针对特定类型组合提供优化的行为或特殊实现。完全特化需要指定模板的所有参数,偏特化只需指定部分参数,或对参数施加某些约束。
    • 第一种偏特化处理第二个模板参数为 int 的情况。
    • 第二种偏特化处理两个模板参数相同的情况。
#include <iostream>// 基本模板
template <typename T, typename U>
class MyClass {
public:void print() {std::cout << "Base template\\n";}
};// 偏特化:特化第二个类型为 int 的情况
template <typename T>
class MyClass<T, int> {
public:void print() {std::cout << "Partially specialized template for T and int\\n";}
};// 偏特化:特化两个类型都为相同类型的情况
template <typename T>
class MyClass<T, T> {
public:void print() {std::cout << "Partially specialized template for T, T\\n";}
};int main() {MyClass<double, double> myClass1;  // 会匹配 MyClass<T, T>MyClass<double, int> myClass2;     // 会匹配 MyClass<T, int>MyClass<double, char> myClass3;    // 会匹配基本模板 MyClass<T, U>myClass1.print();  // 输出: Partially specialized template for T, TmyClass2.print();  // 输出: Partially specialized template for T and intmyClass3.print();  // 输出: Base template
}

4.分配器allocates

分配器(allocators)是用来管理内存分配和回收的对象。

  • 在 VC6 中,operator new() 通常通过调用 malloc() 实现, malloc() 函数不仅会开辟用户请求的内存外,还会引入额外的内存开销
void* operator new(size_t size) {void* p = malloc(size);if (p == 0) // 如果malloc失败,则抛出std::bad_alloc异常throw std::bad_alloc();return p;
}
  • 例如:当我们需要分配512个整型数据时
int *p = allocator<int>().allocate(512,(int *)0);
allocator<int>().deallocate(p,512);
  • 在 VC6 / BC++ / G++中,allocator 类都是使用 operator new 来分配内存,并使用 operator delete 来释放内存。其中,operator new() 通常通过调用 malloc() 实现开辟内存,operator delete() 通常通过调用 free() 实现回收内存:
// VC6 STL中容器对allocator的使用
template<class _Ty, class _A=allocator<_Ty>>  // 调用allocator类
class vector
{ ...
};
template <typename T>
class allocator {
public:typedef size_t    size_type; // size_t是一个无符合整型数据类型typedef ptrdiff_t difference_type;  // 表示同一个数组中任意两个元素之间的差异typedef T*        pointer;typedef T         value_type;pointer allocate(size_type n, const void* hint = 0) {return (pointer) (::operator new(n * sizeof(value_type)));}void deallocate(pointer p, size_type n) {::operator delete(p);}
}
  • 在GCC2.9中
// VC6 STL中容器对allocator的使用
template<class T, class Alloc = alloc>  // 调用allocator类
class vector
{ ...
};

 

①内存池:由一系列内存块组成,每块预分配一定数量的内存。

②自由列表:每个固定大小的内存块都有自己的自由列表。

③大小分类:根据内存请求的大小被分类到不同的自由列表。

  • GCC4.9所附的标准库,其中**__pool_alloc就是GCC2.9中的alloc**

    // 使用方法
    vector<string, __gnn_cxx::__pool_alloc<string>> vec;
    

5.容器的分类

 

6.容器list

G2.9版本:

template <class T, class Alloc = alloc>
class list{
protected:typeof __list_node<T> list_node;  // 1号代码块
public:typeof list_node* link_type;typeof __list_iterator<T,T&,T*> iterator;  // 2号代码块
protected:link_type node;
}
// 1号代码块
template <class T>
struct __list_node {void* prev;void* next;T data;
};
// 2号代码块
template <class T,class Ref,class Ptr>
struct __list_iterator{typedef bidirectional_iterator_tag iterator_category;  // (1)typedef T  value_type;  // (2)typedef Ptr pointer;  // (3)typedef Ref reference;  // (4)typedef ptrdiff_t difference_type;  // (5)typedef __list_node<T> list_node;typedef list_node* list_type;typedef __list_iterator<T,Ref,Ptr> self;link_type node;reference operator*() const{ return (*node).data; }  // 返回引用pointer operator->() const{ return &(operator *());}  // 返回指针。获得该对象的内存地址,即一个指向该对象的指针self& operator++()   // i++{ node = (link_type) ((*node).next); return *this; // 返回自身的引用}// (*node).next是一个 __list_node<T>* 类型的值,加上(list_type)是显式类型转换// (*node).next 等价于 node->next 等价于 (&(*node))->next;// node只是一个迭代器的指针,不是迭代器本身// self&表示返回迭代器的引用self operator++(int)   // ++i{ self tmp = *this; ++*this; return tmp;}
};
  • 前缀递增 (operator++()) 将迭代器向前移动到下一个元素
  • 后缀递增 (operator++(int)) 返回迭代器的一个临时副本(在递增前的状态),然后再递增迭代器。
  • 内置 -> 操作符 用于直接从指针访问对象成员。
  • 重载的 operator->() 提供了一种方式,通过迭代器对象模拟原生指针的行为,允许通过迭代器间接访问对象成员。
  • (*node).next等价于node->next 等价于 (&(*node))->next

G4.9版本:

template<typename _Tp, typename _Alloc=std::allocator<_Tp>>
class list:protected_List_base<_Tp,_Alloc>
{
public:typedef _List_iterator<_Tp> iterator;
}
  • template<typename _Tp, typename _Alloc = std::allocator<_Tp>>
    • 这是一个类模板,接受两个模板参数。
    • _Tp 表示列表中要存储的数据类型。
    • _Alloc 是分配器类型,用于控制链表中元素的内存分配。这个参数有一个默认值,即 std::allocator<_Tp>,这是 C++ 标准库提供的一种通用内存分配器。
  • : protected _List_base<_Tp, _Alloc>
    • list 类从 _List_base 类继承而来,使用保护(protected)继承。这意味着 _List_base 中的公共和保护成员在 list 类中将变为保护成员。
    • _List_base 是一个实现链表基础功能的类
template<typename _Tp>
struct _List_iterator
{typedef _Tp* pointer;typedef _Tp& reference;...
};
// 自身类型的指针使得可以从任何一个节点开始
// 沿着链表向前或向后移动,这对于双向遍历和双向操作非常重要。
struct _List_node_base
{_List_node_base* _M_next;_List_node_base* _M_prev;
};
template<typename _Tp>
struct _List_node:public _List_node_base
{_Tp _M_data;
};

7.Iterator必须提供5中associated types

算法提问:

template<typename T>
incline void
algorithm(T first, T last)  // 迭代器
{...T::iterator_categoryT::value_typeT::pointerT::referenceT::difference_type...
};

迭代器回答:

template <class T,class Ref,class Ptr>
struct __list_iterator{typedef bidirectional_iterator_tag iterator_category;  // (1)typedef T  value_type;  // (2)typedef Ptr pointer;  // (3)typedef Ref reference;  // (4)typedef ptrdiff_t difference_type;  // (5)...
};

8. iterator_traits 类型萃取

但当我们向算法中传入的是指针,而不是迭代器时,就需要用到traits。也就是说,iterator_traits 为所有类型的迭代器(包括原生指针)提供统一的方式来访问迭代器的属性,是在 <iterator> 头文件中定义的。

作用:

std::iterator_traits 模板用于提取迭代器相关的类型信息。

举例:

#include<iostream>
#include<iterator>
#include<vector>template<typename Iterator>
void print_vector(Iterator first, Iterator last)
{// using关键字用来定义类型的别名// typename关键字告诉编译器这是一个依赖于模版参数Iterator的类型,而不是变量using ValueType = typename iterator_traits<Iterator>::value_type;
}int main()
{vector<int> v = {1,2,3,4,5};print_vector(v.begin(), v.end());
}
// 当Iterator是一个类时
template<class Iterator>
struct iterator_traits
{typedef typename Iterator::value_type value_type;
};// 两种偏特化情况
// 当Iterator是一个普通指针时
// 如int*,那么T为int,得到value_type就被定义为“int”
template<class T>
struct iterator_traits<T*>
{typedef T value_type;
};// 当Iterator是一个常量指针(指针的指向可以修改,指针指向的值不能修改)
template<class T>
struct iterator_traits<const T*>
{typedef T value_type;
};
  • Iterator若是int*,ValueType 就是 int
  • Iterator若是const int*,ValueType 还是 int
  • 因为如果 ValueType 是 const int,后续再使用ValueType创建其他容器时,就会受到限制。因为标准库中的容器(如 std::vector)不能存储常量类型的元素,它们需要能被赋值和移动。

完整的iterator_traits:

template<class Iterator>
struct iterator_traits
{typedef typename Iterator::iterator_category iterator_category;typedef typename Iterator::value_type value_type;typedef typename Iterator::pointer iterator_category;typedef typename Iterator::reference reference;typedef typename Iterator::difference_type difference_type;
};template<class T>
struct iterator_traits<T*>
{typedef random_access_iterator_tag iterator_category;typedef T value_type;typedef ptrdiff_t difference_type;typedef T* pointer;typedef T& reference;
};template<class T>
struct iterator_traits<const T*>
{typedef random_access_iterator_tag iterator_category;typedef T value_type;typedef ptrdiff_t difference_type;typedef const T* pointer;typedef const T& reference;
};

9.容器vector

定义:

template <class T, class Alloc = std::allocator<T>>
class vector
{
public:typedef T value_type;typedef T* pointer;typedef &T reference;typedef size_t size_type;
protected:iterator **start**;iterator **finish**;iterator **end_of_range**;Allocator alloc;
public:iterator begin() { return **start**;}iterator end() { return **finish**;}size_type size const { return size_type(end() - start());}size_type capacity() const{ return size_type(**end_of_storage** - begin());}bool empty() const { return begin() == end();}reference operator[](size_type n}{return *(begin()+n);referebce front() {return *begin();}reference back() {return *(end()-1);}
};

push_back操作源码:

template <class T, class Alloc=std::allocator<T>>
void push_back(const T& value)
{if(finish == end_of_storage)  // 原始空间不足{size_type old_size = size();// old_size == 0:当前vector中没有任何元素,新分配的存储空间至少有一个元素的容量// old_size != 0:分配新的容量将是当前大小的两倍, 称为指数增长size_type new_capacity = old_size == 0 ? 1 : 2 * old_size;iterator new_start = alloc.allocator(new_capacity);iterator new_finsih = new_start;try{// 将原数据移动到新空间for(iterator old_iter = start; old_iter != finish; ){alloc.construct(new_finish++, *old_iter);alloc.destroy(old_iter++);}// 添加新元素alloc.construct(new_finish++, value);}catch(...){// 如果构造失败,释放已分配的内存for(iterator it=new_start; it!=new_finish; ++it){alloc.destory(it);}alloc.deallocate(new_start, new_capacity);throw;  // 重新抛出当前异常}// 释放旧空间if (start) {alloc.deallocate(start, end_of_storage - start);}// 更新指针start = new_start;finish = new_finish;end_of_storage = start + new_capacity;} else {alloc.construct(finish++, value); // 有足够空间,直接构造新元素}
}

vector的迭代器iterator:

template <class T, class Alloc = alloc>
class vector
{
public:typedef T value_type;typedef T* iterator;
};// 调用方法
vectot<int> v;
vector<int>::iterator it = v.begin();

10.容器deque

 


// BufSize是指缓冲区buffer的长度
template<class T,class Alloc = alloc, size_t BufSize=0>
class deque
{
public:typedef T value_type;typedef size_t size_type;typedef __deque_iterator<T,T&,T*,BufSiz> iterator;
protected:typedef T** map_pointer;  // 指向指针数组的指针
protected:iterator start;iterator finish;map_point map;  // 指向指针数组的指针,每一个都指向一个缓冲区size_type map_size;
public:iterator begin() {return start;}iterator end() {return finish;}size_type size() {return finish - start;}...
};

deque的迭代器iterator:

template<class T, class Ref, class Ptr, size_t BufSize>
struct __deque_iterator
{typedef random_access_iterator_tag iterator_category;typedef T value_type;typedef Ref reference; // T&typedef Ptr pointer; // T*typedef size_t size_type;typedef ptrdiff_t difference_type;typedef T** map_pointer;typedef __deque_iterator<T,Ref,Ptr,BufSiz> self;T* **cur**;T* **first**;T* **last**;map_point **node**;
};

相关文章:

C++笔记(体系结构与内核分析)

1.OOP面向对象编程 vs. GP泛型编程 OOP将data和method放在一起&#xff0c;目的是通过封装、继承、多态提高软件的可维护性和可扩展性GP将data和method分开&#xff0c;可以将任何容器与任何算法结合使用&#xff0c;只要容器满足塞饭所需的迭代器类型 2.算法与仿函数的区别 …...

c++ 唤醒指定线程

在C中&#xff0c;直接唤醒一个特定的线程并不像在Java的Thread类中有interrupt()方法或者某些操作系统特定的API&#xff08;如POSIX的pthread_cond_signal或Windows的SetEvent&#xff09;那样简单。C标准库没有提供一个直接的方法来"唤醒"一个正在等待的线程。然而…...

java报错:使用mybatis plus查询一个只返回一条数据的sql,却报错返回了1000多条

今天遇到一个问题 系统线上问题&#xff0c;经常出现这样的问题&#xff0c;刚重启系统时不报错了&#xff0c;可是运行一段时间又会出现。sql已经写了limit 1&#xff0c;mybatis的debug日志也返回total为1&#xff0c;可是却报错返回了1805条数据 乍一看&#xff0c;感觉太不…...

AI图书推荐:利用生成式AI实现业务流程超自动化

《利用生成式AI实现业务流程超自动化》&#xff08;Hyperautomation with Generative AI&#xff09;这本书探索了广泛的用例和示例&#xff0c;展示了超自动化在不同行业、领域和特定部门的多样化应用&#xff0c; 让您熟悉UiPath、Automation Anywhere和IBM等流行工具和平台&…...

什么事防抖和节流,有什么区别,如何实现

防抖和节流&#xff0c;本质上是优化高频率执行代码的一种手段&#xff0c;比如&#xff1a;resize、scroll、keypress、mousemove这些事件在触发的时候&#xff0c;会不断调用绑定在事件上的回调函数&#xff0c;这样极大浪费资源&#xff0c;降低前端性能。 为了优化体验&am…...

PanguSync大数据量初始化脚本

由于数据库增量同步软件PanguSync初始化最大超时时间为600s,如果初始数据量很大&#xff0c;第一次部署时可能会超时&#xff0c;可以先停止任务&#xff0c;使用以下Sql语句进行初始化&#xff0c;以下语句可以分步执行&#xff0c;初始化完成后&#xff0c;后续无需再执行耗时…...

DELL T630服务器iDRAC分辨率调整办法

对于Dell T630服务器的iDRAC分辨率调整&#xff0c;您需要登录到iDRAC的Web界面。以下是详细的步骤&#xff1a; 登录iDRAC&#xff1a;在浏览器中输入iDRAC的IP地址&#xff0c;然后使用用户名&#xff08;通常是“root”&#xff09;和密码登录。 导航到虚拟控制台&#xff…...

您真的会高效使用 Mac 吗?

文章目录 屏幕的保养快捷键预览修改文件名查看文件属性搜索编辑复制&#xff0c;粘贴&#xff0c;剪切&#xff0c;撤销删除 跳转窗口屏幕截图声音Dock强制退出查字典神奇的Option键鼠标与触控板切换桌面与应用程序打开通知中心打开Mission Control 安装与卸载Mac应用程序压缩和…...

Vue11 Vue3完结撒花

shallowRef和shallowReactive shallowRef 作用&#xff1a;创建一个响应式数据&#xff0c;但只对顶层属性进行响应式处理 用法 let myVar shallowRef(initialValue)特点&#xff1a;只跟踪引用值变化&#xff0c;不关心值内部的属性变化 案例 <template><div c…...

CodeTop 高频笔试题总结(持续更新)

&#x1f3c6; 频率从高到低排序 &#x1f468;‍&#x1f3eb; 参考的频率数据&#xff1a;CodeTop &#x1f468;‍&#x1f3eb; 力扣hot100 无重复字符的最长子串 双指针 滑动窗口 哈希&#x1f468;‍&#x1f3eb; 力扣hot100 反转链表 指针 递归 一题多解&#x1f468;‍…...

类和对象一(从封装开始讲述)

目录&#xff1a; 一.封装 二.封装扩展之包&#xff0c;自定义包 三.访问限定符 四.static成员 一.封装&#xff1a;封装&#xff1a;将数据和操作数据的方法进行有机结合&#xff0c;隐藏对象的属性和实现细节&#xff0c;仅对外公开接口来和对象进行 交互。面向对象…...

LeetCode100题总结

LeetCode100题总结 前言LeetCode100题总结题型梳理双指针11. 盛最多水的容器234.回文链表75.颜色分类206.反转链表142.环形链表215.三数之和 滑动窗口3. 无重复字符的最长子串209. 长度最小的子数组438. 找到字符串中所有字母异位词 广搜102. 二叉树的层序遍历200. 岛屿数量617…...

基于截断傅里叶级数展开的抖动波形生成

1、背景 抖动是影响信号完整性的重要因素。随着信号速率的不断提高&#xff0c;抖动的影响日益显著。仿真生成抖动时钟或抖动信号&#xff0c;对系统极限性能验证具有重要意义。抖动是定义在时域上的概念&#xff0c;它表征真实跳变位置(如跳边沿或过零点)与理想跳变位…...

图片标注编辑平台搭建系列教程(9)——支持撤销的画线行为

文章目录 背景渲染行为mouseDownmouseMovemouseDbclick总结背景 编辑器中的绘制,要想做的足够好,是需要支持撤销形点的,因为作业员在绘制过程中,可能会点错位置,需要及时撤销,否则影响编辑效率。撤销我们知道,需要通过ID编辑器的history的undo来实现,那么意味着,每一…...

赶紧收藏!2024 年最常见 100道 Java 基础面试题(四十一)

上一篇地址&#xff1a;赶紧收藏&#xff01;2024 年最常见 100道 Java 基础面试题&#xff08;四十&#xff09;-CSDN博客 八十一、tcp为什么要三次握手&#xff0c;两次不行吗&#xff1f;为什么&#xff1f; TCP&#xff08;传输控制协议&#xff09;使用三次握手&#xf…...

使用自关联方法处理多表关系

使用自关联方法处理多表关系 这里通过省市区之间的关系来解释自关联的情况 在设置地址的过程中 , 不可避免的需要设置 , 省份 ,市以及区 而省市区三者之间的具有一定的关联关系 一个省份对应多个市 一个市对应多个区 如果通过设置主表从表关系则需要设置三张标分别对应省…...

annaconda详细解读换源文件

annaconda换源详细解读文件 annaconda换源详细解读文件 annaconda换源详细解读文件 #踩坑/annaconda换源详细解读通道问题 如何准确使用国内源高效安装GPU版本的Pytorch - 知乎 文件中的custom通道&#xff0c;需要自己手动添加到默认通道里面&#xff0c;记得后面更上/包名…...

AI大模型系列:编写高质量提示(prompt)的实践技巧

AI大模型系列专栏 文章收录于AI大模型系列专栏 文明基石&#xff0c;文字与数字的起源与演变自然语言处理&#xff0c;从规则到统计的演变AI魔法师&#xff0c;提示工程的力量编写高质量提示&#xff08;prompt&#xff09;的小技巧编写高质量提示&#xff08;prompt&#xf…...

汽车EDI:安通林Antolin EDI 项目案例

安通林&#xff08;Antolin&#xff09;是一家全球性的汽车零部件制造商&#xff0c;专注于汽车内饰系统和零部件的生产&#xff0c;致力于创新和采用先进的技术。近年来 安通林Antolin 推动其供应商部署EDI系统&#xff0c;使得双方能够通过EDI传输业务单据&#xff0c;极大提…...

今日arXiv最热NLP大模型论文:揭露大语言模型短板,北京大学提出事件推理测试基准

人工智能领域又一里程碑时刻&#xff01;北京大学、北京智源人工智能研究院等机构联合推出大型事件推理评测基准 。这是首个同时在知识和推理层面全面评估大模型事件推理能力的数据集。 总所周知&#xff0c;事件推理需要丰富的事件知识和强大的推理能力&#xff0c;涉及多种推…...

观成科技:隐蔽隧道工具Ligolo-ng加密流量分析

1.工具介绍 Ligolo-ng是一款由go编写的高效隧道工具&#xff0c;该工具基于TUN接口实现其功能&#xff0c;利用反向TCP/TLS连接建立一条隐蔽的通信信道&#xff0c;支持使用Let’s Encrypt自动生成证书。Ligolo-ng的通信隐蔽性体现在其支持多种连接方式&#xff0c;适应复杂网…...

AI-调查研究-01-正念冥想有用吗?对健康的影响及科学指南

点一下关注吧&#xff01;&#xff01;&#xff01;非常感谢&#xff01;&#xff01;持续更新&#xff01;&#xff01;&#xff01; &#x1f680; AI篇持续更新中&#xff01;&#xff08;长期更新&#xff09; 目前2025年06月05日更新到&#xff1a; AI炼丹日志-28 - Aud…...

云计算——弹性云计算器(ECS)

弹性云服务器&#xff1a;ECS 概述 云计算重构了ICT系统&#xff0c;云计算平台厂商推出使得厂家能够主要关注应用管理而非平台管理的云平台&#xff0c;包含如下主要概念。 ECS&#xff08;Elastic Cloud Server&#xff09;&#xff1a;即弹性云服务器&#xff0c;是云计算…...

黑马Mybatis

Mybatis 表现层&#xff1a;页面展示 业务层&#xff1a;逻辑处理 持久层&#xff1a;持久数据化保存 在这里插入图片描述 Mybatis快速入门 ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/6501c2109c4442118ceb6014725e48e4.png //logback.xml <?xml ver…...

UE5 学习系列(三)创建和移动物体

这篇博客是该系列的第三篇&#xff0c;是在之前两篇博客的基础上展开&#xff0c;主要介绍如何在操作界面中创建和拖动物体&#xff0c;这篇博客跟随的视频链接如下&#xff1a; B 站视频&#xff1a;s03-创建和移动物体 如果你不打算开之前的博客并且对UE5 比较熟的话按照以…...

深入理解JavaScript设计模式之单例模式

目录 什么是单例模式为什么需要单例模式常见应用场景包括 单例模式实现透明单例模式实现不透明单例模式用代理实现单例模式javaScript中的单例模式使用命名空间使用闭包封装私有变量 惰性单例通用的惰性单例 结语 什么是单例模式 单例模式&#xff08;Singleton Pattern&#…...

Java多线程实现之Callable接口深度解析

Java多线程实现之Callable接口深度解析 一、Callable接口概述1.1 接口定义1.2 与Runnable接口的对比1.3 Future接口与FutureTask类 二、Callable接口的基本使用方法2.1 传统方式实现Callable接口2.2 使用Lambda表达式简化Callable实现2.3 使用FutureTask类执行Callable任务 三、…...

sqlserver 根据指定字符 解析拼接字符串

DECLARE LotNo NVARCHAR(50)A,B,C DECLARE xml XML ( SELECT <x> REPLACE(LotNo, ,, </x><x>) </x> ) DECLARE ErrorCode NVARCHAR(50) -- 提取 XML 中的值 SELECT value x.value(., VARCHAR(MAX))…...

OPenCV CUDA模块图像处理-----对图像执行 均值漂移滤波(Mean Shift Filtering)函数meanShiftFiltering()

操作系统&#xff1a;ubuntu22.04 OpenCV版本&#xff1a;OpenCV4.9 IDE:Visual Studio Code 编程语言&#xff1a;C11 算法描述 在 GPU 上对图像执行 均值漂移滤波&#xff08;Mean Shift Filtering&#xff09;&#xff0c;用于图像分割或平滑处理。 该函数将输入图像中的…...

深度学习习题2

1.如果增加神经网络的宽度&#xff0c;精确度会增加到一个特定阈值后&#xff0c;便开始降低。造成这一现象的可能原因是什么&#xff1f; A、即使增加卷积核的数量&#xff0c;只有少部分的核会被用作预测 B、当卷积核数量增加时&#xff0c;神经网络的预测能力会降低 C、当卷…...