
笔记
文章平均质量分 51
???/cy
算法工程师,日常分享多模态领域的前沿成果,与自己工程经验的总结,问道~大模型
展开
-
list(zip(*out))
# 声明一个列表nums = [['a1', 'a2', 'a3'], ['b1', 'b2', 'b3']]# 参数为list数组时,是压缩数据,相当于zip()函数iters = zip(*nums) # 输出zip(*zipped)函数返回对象的类型# print("type of iters is %s" % type(iters))# 因为zip(*zipped)函数返回一个zip类型对象,所以我们需要对其进行转换# 在这里,我们将其转换为列表print(list(ite..原创 2021-12-26 14:51:56 · 688 阅读 · 0 评论 -
python|axis
axis是将矩阵进行分组原始矩阵的shape=[3,4,5],取axis=0再进行操作后,得到的矩阵shape=[4,5]。取axis=1再进行操作后,得到的矩阵shape=[3,5]。取axis=-1(axis=2)再操作后,shape=[3,4]。掌握这一点,能有利于你在神经网络中的变换或是数据操作中明确矩阵变换前后的形状...原创 2021-07-28 10:03:14 · 290 阅读 · 0 评论 -
C++|Passing arguments by reference
目的:While pass by value is suitable in many cases, it has a couple of limitations. First, when passing a large struct or class to a function, pass by value will make a copy of the argument into the function parameter. In many cases, this is a needless per原创 2021-07-06 15:42:18 · 501 阅读 · 0 评论 -
C++|Const
Classesare an expanded concept ofdata structures: like data structures, they can contain data members, but they can also contain functions as members.class class_name { access_specifier_1: member1; access_specifier_2: member2; ...} ob...原创 2021-07-06 13:51:38 · 98 阅读 · 0 评论 -
C++|Other data types
Type aliases (typedef / using)In C++, any valid type can be aliased so that it can be referred to with a different identifier.//using new_type_name = existing_type ;using C = char;using WORD = unsigned int;using pChar = char *;using field = char.原创 2021-06-28 15:47:48 · 228 阅读 · 0 评论 -
C++|Data structures
Data structuresAdata structureis a group of data elements grouped together under one name. These data elements, known asmembers, can have different types and different lengths. Data structures can be declared in C++ using the following syntax:struc...原创 2021-06-25 20:09:28 · 137 阅读 · 0 评论 -
C++|Dynamic memory
In the programs seen in previous chapters, all memory needs were determined before program execution by defining the variables needed. But there may be cases where the memory needs of a program can only be determined during runtime. For example, when the m原创 2021-06-25 17:36:34 · 183 阅读 · 0 评论 -
C++|Pointer
Address-of operator (&)The address of a variable can be obtained by preceding the name of a variable with an ampersand sign (&), known asaddress-of operator. For example:int *foo;foo = &myvar; //foo 必须是个指针,才能存&This would assign t..原创 2021-06-25 16:35:44 · 160 阅读 · 0 评论 -
C++|Pointer arithmetics
*p++ // same as *(p++): increment pointer, and dereference unincremented address*++p // same as *(++p): increment pointer, and dereference incremented address++*p // same as ++(*p): dereference pointer, and increment the value it points to(*p)++ .原创 2021-06-25 11:26:57 · 180 阅读 · 0 评论 -
C++|Array
A typical declaration for an array in C++ is:type name [elements];wheretypeis a valid type (such asint,float...),nameis a valid identifier and theelementsfield (which is always enclosed in square brackets[]), specifies the length of the array i...原创 2021-06-24 11:27:43 · 194 阅读 · 0 评论 -
C++|Namespaces,Storage classes
Namespaces allow us to group named entities that otherwise would haveglobal scopeinto narrower scopes, giving themnamespace scope. This allows organizing the elements of programs into different logical scopes referred to by names.namespace identifier...原创 2021-06-24 10:10:04 · 101 阅读 · 0 评论 -
C++|Templates
Defining a function template follows the same syntax as a regular function, except that it is preceded by thetemplatekeyword and a series of template parameters enclosed in angle-brackets <>:template <template-parameters> function-declarati..原创 2021-06-24 09:32:21 · 104 阅读 · 0 评论 -
C++|inline function,Declaring functions,Recursivity
inline functionCalling a function generally causes a certain overhead (stacking arguments, jumps, etc...), and thus for very short functions, it may be more efficient to simply insert the code of the function where it is called, instead of performing the原创 2021-06-23 16:17:13 · 147 阅读 · 0 评论 -
C++|Efficiency considerations and const references
string concatenate (string a, string b){ return a+b;}This function takes two strings as parameters (by value), and returns the result of concatenating them. By passing the arguments by value, the function forcesaandbto be copies of the arguments...原创 2021-06-23 15:36:16 · 122 阅读 · 0 评论 -
C++|Functions with no type. The use of void
The syntax shown above for functions:type name ( argument1, argument2 ...) { statements }Requires the declaration to begin with a type. This is the type of the value returned by the function. But what if the function does not need to return a value? In th原创 2021-06-23 15:10:31 · 145 阅读 · 0 评论 -
C++|Arguments passed by value and by reference
// passing parameters by reference#include <iostream>using namespace std;void duplicate (int& a, int& b, int& c){ a*=2; b*=2; c*=2;}int main (){ int x=1, y=3, z=7; duplicate (x, y, z); cout << "x=" << x &.原创 2021-06-23 15:04:48 · 133 阅读 · 0 评论 -
C++|stringstream
The standard header<sstream>defines a type calledstringstreamthat allows a string to be treated as a stream, and thus allowing extraction or insertion operations from/to strings in the same way as they are performed oncinandcout. This feature ...原创 2021-06-23 15:02:02 · 112 阅读 · 0 评论 -
C++|using, string, vector
1,命名空间的using声明作用域操作符(::)编译器应从操作符左侧名字所示的作用域中寻找右侧那个名字。std::cin的意思就是要使用mingmingko原创 2021-06-23 14:26:05 · 225 阅读 · 0 评论 -
C++|算数类型;引用;指针;
1.可寻址的最小内存块称为“字节(byte)”2. 存储的基本单元称为“字(word)”原创 2021-06-16 13:25:26 · 161 阅读 · 0 评论 -
python|把一个文件下的内容,分成几个文件
import shutilimport osfile_path = '你的绝对路径'def divide_files(file_path, sub_file_num):#sub_file_num 是 你想要分成几个文件夹 name = os.listdir(file_path) name_num = len(name) each_file_num = int(name_num/sub_file_num) #我的文件内容是成对的(img,xml) 所以不能出现奇数.原创 2021-06-13 18:58:42 · 645 阅读 · 0 评论 -
C++|读取多个ISBN的销售记录,输出所有记录的和
#include<iostream>#include "Sales_item.h"int main(){ Sales_item total, book; std::cout << "请输入几个ISBN相同的书籍" << std::endl; if (std::cin >> total) { while (std::cin >> book) { if (compareIsbn(total, book)) { tot.原创 2021-06-04 11:25:47 · 426 阅读 · 0 评论 -
C++|读取数量不定的输入数据
#include<iostream>int main(){ int sum = 0, value = 0; while (std::cin >> value) { sum += value; } std::cout << sum << std::endl; std::cin.get();}原创 2021-06-03 17:38:27 · 229 阅读 · 0 评论 -
数据处理:TEXT变成数值
#results是一个TEXT:大概长这样 ('[[1,2,3,4# 5,6,7,8]]')for each in results: each = each[0] print(each) each = each.replace('[','').replace(']','').replace('\n',' ') print(each) tokens = each.split() print(to.原创 2021-05-11 10:21:41 · 423 阅读 · 0 评论 -
MySQL|EXISTS 运算符
Table:-- Select clients that have an invoiceSELECT *FROM clients cWHERE EXISTS( SELECT client_id FROM invoices WHERE client_id = c.client_id)output:原创 2021-04-19 13:36:57 · 147 阅读 · 0 评论 -
MySQL|相关子查询 Correlated subqueries
--Select employees whose salary is above the average in their office-- GET invoices that are larger than the client's average invoice amountSELECT *FROM invoices iWHERE invoice_total > ( SELECT AVG(invoice_total) FROM invoices WHERE clien原创 2021-04-19 11:47:29 · 228 阅读 · 0 评论 -
MySQL|ANY关键字
--Select client with at least two invoices__________________________________________count___________________________________________________看一下COUNT的用法:SELECT client_id, COUNT(*)FROM invoicesGROUP BY client_idOutput:_________________________原创 2021-04-19 10:56:18 · 248 阅读 · 0 评论 -
MySQL|ALL 关键字
-- Select invoices larger than all invoices of client 3USE sql_invoicing;SELECT *FROM invoicesWHERE invoice_total >( SELECT MAX(invoice_total) FROM invoices WHERE invoice_id = 3)Other solution(with ALL 关键字):USE sql_invoicing;SELEC原创 2021-04-19 10:35:59 · 497 阅读 · 0 评论 -
MySQL| Subqueries vs joins
-- Find customers who have ordered lettuce(id = 3)-- Select customer_id, first_name, last_nameSELECT *FROM customers-- 在下面的子查询中, 返回订购了生菜的顾客的IDWHERE customer_id IN ( SELECT o.customer_id FROM order_items oi JOIN orders o USING(orde...原创 2021-04-19 10:23:06 · 123 阅读 · 0 评论 -
MySQL|IN运算符
-- Find the products that have never been orderedUSE sql_store;SELECT *FROM productsWHERE product_id NOT IN( SELECT DISTINCT product_id FROM order_items)Output:-------------------------------------------------------------------作业---.原创 2021-04-18 19:13:23 · 116 阅读 · 0 评论 -
MySQL|编写子查询
-- FIND products that are more-- expensive than Lettuce(id = 3)SELECT *FROM productsWHERE unit_price > ( SELECT unit_price FROM products WHERE product_id = 3)-- (这里面是lettuce的价格)Output:-------------------------------------------.原创 2021-04-18 18:55:11 · 79 阅读 · 0 评论 -
MySQL| With rollup
SELECT pm.name AS payment_method, sum(amount) AS totalFROM payments p JOIN payment_methods pm ON p.payment_method = pm.payment_method_idGROUP BY pm.name WITH ROLLUPOutput:原创 2021-04-18 18:39:32 · 85 阅读 · 0 评论 -
MySql |TheHAVING Clause
SELECT client_id, SUM(invoice_total) AS total_salesFROM invoicesGROUP BY client_id -- 分组HAVING total_sales > 500-- 使用having子句:为了在分组之后进行筛选Output:-------------------------------------------------作业-----------------------------------..原创 2021-04-18 18:15:03 · 203 阅读 · 0 评论 -
MySQL GROUP BY 子句| The GROUP BY Clause
SELECT client_id, SUM(invoice_total) AS total_salesFROM invoicesWHERE invoice_date >= '2019-07-01'GROUP BY client_id -- 看每一个顾客花的钱ORDER BY total_sales DESC -- 按照total_sales 的降序来显示 看看谁花的多-- 注意顺序 永远是 FROM WHERE GROUP_BY ORDER_BY 这个顺序哈Ou.原创 2021-04-17 16:37:00 · 113 阅读 · 0 评论