X_train = torch.Tensor(X_train).long()是什么意思

时间: 2023-05-25 10:05:50 浏览: 41
这行代码将一个numpy数组转换为PyTorch张量,并指定张量的数据类型为long。通常情况下,张量必须是PyTorch模型中的数据格式之一,以便能够对它们进行操作和优化。这里使用“long”数据类型是因为原始数据可能是整数类型。
相关问题

修改一下这段代码在pycharm中的实现,import pandas as pd import numpy as np from sklearn.model_selection import train_test_split import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim #from torchvision import datasets,transforms import torch.utils.data as data #from torch .nn:utils import weight_norm import matplotlib.pyplot as plt from sklearn.metrics import precision_score from sklearn.metrics import recall_score from sklearn.metrics import f1_score from sklearn.metrics import cohen_kappa_score data_ = pd.read_csv(open(r"C:\Users\zhangjinyue\Desktop\rice.csv"),header=None) data_ = np.array(data_).astype('float64') train_data =data_[:,:520] train_Data =np.array(train_data).astype('float64') train_labels=data_[:,520] train_labels=np.array(train_data).astype('float64') train_data,train_data,train_labels,train_labels=train_test_split(train_data,train_labels,test_size=0.33333) train_data=torch.Tensor(train_data) train_data=torch.LongTensor(train_labels) train_data=train_data.reshape(-1,1,20,26) train_data=torch.Tensor(train_data) train_data=torch.LongTensor(train_labels) train_data=train_data.reshape(-1,1,20,26) start_epoch=1 num_epoch=1 BATCH_SIZE=70 Ir=0.001 classes=('0','1','2','3','4','5') device=torch.device("cuda"if torch.cuda.is_available()else"cpu") torch.backends.cudnn.benchmark=True best_acc=0.0 train_dataset=data.TensorDataset(train_data,train_labels) test_dataset=data.TensorDataset(train_data,train_labels) train_loader=torch.utills.data.DataLoader(dtaset=train_dataset,batch_size=BATCH_SIZE,shuffle=True) test_loader=torch.utills.data.DataLoader(dtaset=train_dataset,batch_size=BATCH_SIZE,shuffle=True)

修改后的代码如下所示: ```python import pandas as pd import numpy as np from sklearn.model_selection import train_test_split import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.utils.data as data import matplotlib.pyplot as plt from sklearn.metrics import precision_score, recall_score, f1_score, cohen_kappa_score data_ = pd.read_csv(r"C:\Users\zhangjinyue\Desktop\rice.csv", header=None) data_ = np.array(data_).astype('float64') train_data = data_[:, :520] train_labels = data_[:, 520] train_data, _, train_labels, _ = train_test_split(train_data, train_labels, test_size=0.33333) train_data = torch.Tensor(train_data) train_labels = torch.LongTensor(train_labels) train_data = train_data.reshape(-1, 1, 20, 26) start_epoch = 1 num_epoch = 1 BATCH_SIZE = 70 Ir = 0.001 classes = ('0', '1', '2', '3', '4', '5') device = torch.device("cuda" if torch.cuda.is_available() else "cpu") torch.backends.cudnn.benchmark = True best_acc = 0.0 train_dataset = data.TensorDataset(train_data, train_labels) test_dataset = data.TensorDataset(train_data, train_labels) train_loader = torch.utils.data.DataLoader(dataset=train_dataset, batch_size=BATCH_SIZE, shuffle=True) test_loader = torch.utils.data.DataLoader(dataset=train_dataset, batch_size=BATCH_SIZE, shuffle=True) ``` 请注意,我做了以下修改: 1. 移除了不需要的导入语句。 2. 修复了变量名拼写错误。 3. 移除了重复的代码行。 4. 修正了 `torch.utils.data.DataLoader` 的拼写错误。 5. 修正了数据集分割时的变量名错误。 请根据你的实际需求进一步调整代码。

X_train = torch.Tensor(X_train).long() X_train = torch.zeros(X_train.size(0), 122).scatter_(1, X_train, 1)这两句代码什么意思

这两句代码首先将`X_train`转换为`torch.Tensor`类型,并将其显示为长整型(`long`)。然后,它创建了一个大小为`(X_train.size(0), 122)`的全零张量,并使用`scatter_`函数在每个样本中标记其对应的特征。具体来说,`scatter_(1, X_train, 1)`将每行中特定位置的值设置为`1`,该位置由`X_train`中的值指定。这样能够将原始特征矩阵转换为一组one-hot向量,每个向量都代表一个特征。

相关推荐

帮我看看这段代码报错原因: Traceback (most recent call last): File "/home/bder73002/hpy/ConvNextV2_Demo/train+.py", line 274, in <module> train_loss, train_acc = train(model_ft, DEVICE, train_loader, optimizer, epoch,model_ema) File "/home/bder73002/hpy/ConvNextV2_Demo/train+.py", line 48, in train loss = torch.nan_to_num(criterion_train(output, targets)) # 计算loss File "/home/bder73002/anaconda3/envs/python3.9.2/lib/python3.9/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/bder73002/hpy/ConvNextV2_Demo/models/losses.py", line 38, in forward index.scatter_(1, target.data.view(-1, 1).type(torch.LongTensor), 1) RuntimeError: Expected index [128, 1] to be smaller than self [16, 8] apart from dimension 1 部分代码如下:cls_num_list = np.zeros(classes) for , label in train_loader.dataset: cls_num_list[label] += 1 criterion_train = LDAMLoss(cls_num_list=cls_num_list, max_m=0.5, s=30) class LDAMLoss(nn.Module): def __init__(self, cls_num_list, max_m=0.5, weight=None, s=30): super(LDAMLoss, self).__init__() m_list = 1.0 / np.sqrt(np.sqrt(cls_num_list)) m_list = m_list * (max_m / np.max(m_list)) m_list = torch.cuda.FloatTensor(m_list) self.m_list = m_list assert s > 0 self.s = s self.weight = weight def forward(self, x, target): index = torch.zeros_like(x, dtype=torch.uint8) # index.scatter_(1, target.data.view(-1, 1), 1) index.scatter_(1, target.data.view(-1, 1).type(torch.LongTensor), 1) index_float = index.type(torch.cuda.FloatTensor) batch_m = torch.matmul(self.m_list[None, :], index_float.transpose(0,1)) batch_m = batch_m.view((-1, 1)) x_m = x - batch_m output = torch.where(index, x_m, x) return F.cross_entropy(self.s*output, target, weight=self.weight)

pytorch代码如下:class LDAMLoss(nn.Module): def init(self, cls_num_list, max_m=0.5, weight=None, s=30): super(LDAMLoss, self).init() m_list = 1.0 / np.sqrt(np.sqrt(cls_num_list)) m_list = m_list * (max_m / np.max(m_list)) m_list = torch.cuda.FloatTensor(m_list) self.m_list = m_list assert s > 0 self.s = s if weight is not None: weight = torch.FloatTensor(weight).cuda() self.weight = weight self.cls_num_list = cls_num_list def forward(self, x, target): index = torch.zeros_like(x, dtype=torch.uint8) index_float = index.type(torch.cuda.FloatTensor) batch_m = torch.matmul(self.m_list[None, :], index_float.transpose(1,0)) # 0,1 batch_m = batch_m.view((-1, 1)) # size=(batch_size, 1) (-1,1) x_m = x - batch_m output = torch.where(index, x_m, x) if self.weight is not None: output = output * self.weight[None, :] logit = output * self.s return F.cross_entropy(logit, target, weight=self.weight) classes=7, cls_num_list = np.zeros(classes) for , label in train_loader.dataset: cls_num_list[label] += 1 criterion_train = LDAMLoss(cls_num_list=cls_num_list, max_m=0.5, s=30) criterion_val = LDAMLoss(cls_num_list=cls_num_list, max_m=0.5, s=30) for batch_idx, (data, target) in enumerate(train_loader): data, target = data.to(device, non_blocking=True), Variable(target).to(device,non_blocking=True) # 3、将数据输入mixup_fn生成mixup数据 samples, targets = mixup_fn(data, target) targets = torch.tensor(targets).to(torch.long) # 4、将上一步生成的数据输入model,输出预测结果,再计算loss output = model(samples) # 5、梯度清零(将loss关于weight的导数变成0) optimizer.zero_grad() # 6、若使用混合精度 if use_amp: with torch.cuda.amp.autocast(): # 开启混合精度 loss = torch.nan_to_num(criterion_train(output, targets)) # 计算loss scaler.scale(loss).backward() # 梯度放大 torch.nn.utils.clip_grad_norm(model.parameters(), CLIP_GRAD) # 梯度裁剪,防止梯度爆炸 scaler.step(optimizer) # 更新下一次迭代的scaler scaler.update() 报错:File "/home/adminis/hpy/ConvNextV2_Demo/models/losses.py", line 53, in forward return F.cross_entropy(logit, target, weight=self.weight) File "/home/adminis/anaconda3/envs/wln/lib/python3.9/site-packages/torch/nn/functional.py", line 2824, in cross_entropy return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index) RuntimeError: multi-target not supported at /pytorch/aten/src/THCUNN/generic/ClassNLLCriterion.cu:15

运行以下Python代码:import torchimport torch.nn as nnimport torch.optim as optimfrom torchvision import datasets, transformsfrom torch.utils.data import DataLoaderfrom torch.autograd import Variableclass Generator(nn.Module): def __init__(self, input_dim, output_dim, num_filters): super(Generator, self).__init__() self.input_dim = input_dim self.output_dim = output_dim self.num_filters = num_filters self.net = nn.Sequential( nn.Linear(input_dim, num_filters), nn.ReLU(), nn.Linear(num_filters, num_filters*2), nn.ReLU(), nn.Linear(num_filters*2, num_filters*4), nn.ReLU(), nn.Linear(num_filters*4, output_dim), nn.Tanh() ) def forward(self, x): x = self.net(x) return xclass Discriminator(nn.Module): def __init__(self, input_dim, num_filters): super(Discriminator, self).__init__() self.input_dim = input_dim self.num_filters = num_filters self.net = nn.Sequential( nn.Linear(input_dim, num_filters*4), nn.LeakyReLU(0.2), nn.Linear(num_filters*4, num_filters*2), nn.LeakyReLU(0.2), nn.Linear(num_filters*2, num_filters), nn.LeakyReLU(0.2), nn.Linear(num_filters, 1), nn.Sigmoid() ) def forward(self, x): x = self.net(x) return xclass ConditionalGAN(object): def __init__(self, input_dim, output_dim, num_filters, learning_rate): self.generator = Generator(input_dim, output_dim, num_filters) self.discriminator = Discriminator(input_dim+1, num_filters) self.optimizer_G = optim.Adam(self.generator.parameters(), lr=learning_rate) self.optimizer_D = optim.Adam(self.discriminator.parameters(), lr=learning_rate) def train(self, data_loader, num_epochs): for epoch in range(num_epochs): for i, (inputs, labels) in enumerate(data_loader): # Train discriminator with real data real_inputs = Variable(inputs) real_labels = Variable(labels) real_labels = real_labels.view(real_labels.size(0), 1) real_inputs = torch.cat((real_inputs, real_labels), 1) real_outputs = self.discriminator(real_inputs) real_loss = nn.BCELoss()(real_outputs, torch.ones(real_outputs.size())) # Train discriminator with fake data noise = Variable(torch.randn(inputs.size(0), self.generator.input_dim)) fake_labels = Variable(torch.LongTensor(inputs.size(0)).random_(0, 10)) fake_labels = fake_labels.view(fake_labels.size(0), 1) fake_inputs = self.generator(torch.cat((noise, fake_labels.float()), 1)) fake_inputs = torch.cat((fake_inputs, fake_labels), 1) fake_outputs = self.discriminator(fake_inputs) fake_loss = nn.BCELoss()(fake_outputs, torch.zeros(fake_outputs.size())) # Backpropagate and update weights for discriminator discriminator_loss = real_loss + fake_loss self.discriminator.zero_grad() discriminator_loss.backward() self.optimizer_D.step() # Train generator noise = Variable(torch.randn(inputs.size(0), self.generator.input_dim)) fake_labels = Variable(torch.LongTensor(inputs.size(0)).random_(0,

pytorch部分代码如下:class LDAMLoss(nn.Module): def init(self, cls_num_list, max_m=0.5, weight=None, s=30): super(LDAMLoss, self).init() m_list = 1.0 / np.sqrt(np.sqrt(cls_num_list)) m_list = m_list * (max_m / np.max(m_list)) m_list = torch.cuda.FloatTensor(m_list) self.m_list = m_list assert s > 0 self.s = s if weight is not None: weight = torch.FloatTensor(weight).cuda() self.weight = weight self.cls_num_list = cls_num_list def forward(self, x, target): index = torch.zeros_like(x, dtype=torch.uint8) index_float = index.type(torch.cuda.FloatTensor) batch_m = torch.matmul(self.m_list[None, :], index_float.transpose(0,1)) batch_m = batch_m.view((-1, 1)) # size=(batch_size, 1) (-1,1) x_m = x - batch_m output = torch.where(index, x_m, x) if self.weight is not None: output = output * self.weight[None, :] logit = output * self.s return F.cross_entropy(logit, target, weight=self.weight) train_loader = torch.utils.data.DataLoader(dataset_train, batch_size=BATCH_SIZE, shuffle=True,drop_last=True) test_loader = torch.utils.data.DataLoader(dataset_test, batch_size=BATCH_SIZE, shuffle=True) cls_num_list = np.zeros(classes) for , label in train_loader.dataset: cls_num_list[label] += 1 criterion_train = LDAMLoss(cls_num_list=cls_num_list, max_m=0.5, s=30) criterion_val = LDAMLoss(cls_num_list=cls_num_list, max_m=0.5, s=30) mixup_fn = Mixup( mixup_alpha=0.8, cutmix_alpha=1.0, cutmix_minmax=None, prob=0.1, switch_prob=0.5, mode='batch', label_smoothing=0.1, num_classes=classes) for batch_idx, (data, target) in enumerate(train_loader): data, target = data.to(device, non_blocking=True), Variable(target).to(device,non_blocking=True) # 3、将数据输入mixup_fn生成mixup数据 samples, targets = mixup_fn(data, target) targets = torch.tensor(targets).to(torch.long) # 4、将上一步生成的数据输入model,输出预测结果,再计算loss output = model(samples) # 5、梯度清零(将loss关于weight的导数变成0) optimizer.zero_grad() # 6、若使用混合精度 if use_amp: with torch.cuda.amp.autocast(): # 开启混合精度 loss = torch.nan_to_num(criterion_train(output, targets)) # 计算loss scaler.scale(loss).backward() # 梯度放大 torch.nn.utils.clip_grad_norm(model.parameters(), CLIP_GRAD) # 梯度裁剪,防止梯度爆炸 scaler.step(optimizer) # 更新下一次迭代的scaler scaler.update() # 否则,直接反向传播求梯度 else: loss = criterion_train(output, targets) loss.backward() torch.nn.utils.clip_grad_norm_(model.parameters(), CLIP_GRAD) optimizer.step() 报错:RuntimeError: Expected index [112, 1] to be smaller than self [16, 7] apart from dimension 1

帮我看看这段代码报错原因:Traceback (most recent call last): File "/home/bder73002/hpy/ConvNextV2_Demo/train+.py", line 272, in <module> train_loss, train_acc = train(model_ft, DEVICE, train_loader, optimizer, epoch,model_ema) File "/home/bder73002/hpy/ConvNextV2_Demo/train+.py", line 48, in train loss = torch.nan_to_num(criterion_train(output, targets)) # 计算loss File "/home/bder73002/anaconda3/envs/python3.9.2/lib/python3.9/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/bder73002/hpy/ConvNextV2_Demo/models/losses.py", line 37, in forward index.scatter_(1, target.data.view(-1, 1), 1) IndexError: scatter_(): Expected dtype int64 for index. 部分代码如下:cls_num_list = np.zeros(classes) for _, label in train_loader.dataset: cls_num_list[label] += 1 criterion_train = LDAMLoss(cls_num_list=cls_num_list, max_m=0.5, s=30) class LDAMLoss(nn.Module): def __init__(self, cls_num_list, max_m=0.5, weight=None, s=30): super(LDAMLoss, self).__init__() m_list = 1.0 / np.sqrt(np.sqrt(cls_num_list)) m_list = m_list * (max_m / np.max(m_list)) m_list = torch.cuda.FloatTensor(m_list) self.m_list = m_list assert s > 0 self.s = s self.weight = weight def forward(self, x, target): index = torch.zeros_like(x, dtype=torch.uint8) index.scatter_(1, target.data.view(-1, 1), 1) index_float = index.type(torch.cuda.FloatTensor) batch_m = torch.matmul(self.m_list[None, :], index_float.transpose(0,1)) batch_m = batch_m.view((-1, 1)) x_m = x - batch_m output = torch.where(index, x_m, x) return F.cross_entropy(self.s*output, target, weight=self.weight)

def compute_mAP(trn_binary, tst_binary, trn_label, tst_label): """ compute mAP by searching testset from trainset https://github.com/flyingpot/pytorch_deephash """ for x in trn_binary, tst_binary, trn_label, tst_label: x.long() AP = [] Ns = torch.arange(1, trn_binary.size(0) + 1) Ntest = torch.arange(1, tst_binary.size(0) + 1) print("trn_binary.size(0):",trn_binary.size(0)) print("tst_binary.size(0):", tst_binary.size(0)) print("Ns:",Ns) print("Ns:", Ntest) # print("Ns(train):",Ns) for i in range(tst_binary.size(0)): query_label, query_binary = tst_label[i], tst_binary[i] # 把测试图像编码和标签赋值给->查询图像编码和标签 _, query_result = torch.sum((query_binary != trn_binary).long(), dim=1).sort() # 判断查询图像编码是否等于训练图像编码,相等的总和,并排序。 print("查询标签-----------------------------------------------------:",query_label) print("查询二进制:", query_binary) print(len(query_binary)) print("查询结果:",query_result) print("是否相等:",query_binary != trn_binary) print("查询结果1:", torch.sum((query_binary != trn_binary).long(), dim=1)) print("查询结果2:",torch.sum((query_binary != trn_binary).long(), dim=1).sort()) correct = (query_label == trn_label[query_result]).float() # 正确匹配的二进制编码个数 print("trn_label[query_result]:",trn_label[query_result]) num_ones = torch.sum(correct == 1) print("查询正确的个数:",num_ones) print("查询正确:",correct) P = torch.cumsum(correct, dim=0) / Ns print("torch.cumsum(correct, dim=0)",torch.cumsum(correct, dim=0)) print("查询正确/Ns",torch.Tensor(P)) #每个位置的精度 P AP.append(torch.sum(P * correct) / torch.sum(correct)) # print("---:",AP) acc = num_ones / tst_binary.size(0) print("ACC================================== ", acc) mAP = torch.mean(torch.Tensor(AP)) return mAP 请问怎么将这段代码改成EER评估指标的代码

最新推荐

recommend-type

前18大旋转修整器企业占据全球87%的市场份额.docx

前18大旋转修整器企业占据全球87%的市场份额
recommend-type

Planet-SkySat-Imagery-Product-Specification-Jan2020.pdf

SKYSAT IMAGERY PRODUCT SPECIFICATION PLANET.COM VIDEO Full motion videos are collected between 30 and 120 seconds by a single camera from any of the active SkySats. Videos are collected using only the Panchromatic half of the camera, hence all videos are PAN only. Videos are packaged and delivered with a video mpeg-4 file, plus all image frames with accompanying video metadata and a frame index file (reference Product Types below)
recommend-type

JSBSim Reference Manual

JSBSim参考手册,其中包含JSBSim简介,JSBSim配置文件xml的编写语法,编程手册以及一些应用实例等。其中有部分内容还没有写完,估计有生之年很难看到完整版了,但是内容还是很有参考价值的。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

实现实时数据湖架构:Kafka与Hive集成

![实现实时数据湖架构:Kafka与Hive集成](https://img-blog.csdnimg.cn/img_convert/10eb2e6972b3b6086286fc64c0b3ee41.jpeg) # 1. 实时数据湖架构概述** 实时数据湖是一种现代数据管理架构,它允许企业以低延迟的方式收集、存储和处理大量数据。与传统数据仓库不同,实时数据湖不依赖于预先定义的模式,而是采用灵活的架构,可以处理各种数据类型和格式。这种架构为企业提供了以下优势: - **实时洞察:**实时数据湖允许企业访问最新的数据,从而做出更明智的决策。 - **数据民主化:**实时数据湖使各种利益相关者都可
recommend-type

python 如何将DWG转DXF

Python可以使用CAD软件的COM组件进行DWG到DXF的转换。以下是示例代码: ```python import win32com.client def dwg_to_dxf(dwg_path, dxf_path): acad = win32com.client.Dispatch("AutoCAD.Application") doc = acad.Documents.Open(dwg_path) doc.SaveAs(dxf_path, win32com.client.constants.acDXF) doc.Close() acad.Quit
recommend-type

c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf

校园超市商品信息管理系统课程设计旨在帮助学生深入理解程序设计的基础知识,同时锻炼他们的实际操作能力。通过设计和实现一个校园超市商品信息管理系统,学生掌握了如何利用计算机科学与技术知识解决实际问题的能力。在课程设计过程中,学生需要对超市商品和销售员的关系进行有效管理,使系统功能更全面、实用,从而提高用户体验和便利性。 学生在课程设计过程中展现了积极的学习态度和纪律,没有缺勤情况,演示过程流畅且作品具有很强的使用价值。设计报告完整详细,展现了对问题的深入思考和解决能力。在答辩环节中,学生能够自信地回答问题,展示出扎实的专业知识和逻辑思维能力。教师对学生的表现予以肯定,认为学生在课程设计中表现出色,值得称赞。 整个课程设计过程包括平时成绩、报告成绩和演示与答辩成绩三个部分,其中平时表现占比20%,报告成绩占比40%,演示与答辩成绩占比40%。通过这三个部分的综合评定,最终为学生总成绩提供参考。总评分以百分制计算,全面评估学生在课程设计中的各项表现,最终为学生提供综合评价和反馈意见。 通过校园超市商品信息管理系统课程设计,学生不仅提升了对程序设计基础知识的理解与应用能力,同时也增强了团队协作和沟通能力。这一过程旨在培养学生综合运用技术解决问题的能力,为其未来的专业发展打下坚实基础。学生在进行校园超市商品信息管理系统课程设计过程中,不仅获得了理论知识的提升,同时也锻炼了实践能力和创新思维,为其未来的职业发展奠定了坚实基础。 校园超市商品信息管理系统课程设计的目的在于促进学生对程序设计基础知识的深入理解与掌握,同时培养学生解决实际问题的能力。通过对系统功能和用户需求的全面考量,学生设计了一个实用、高效的校园超市商品信息管理系统,为用户提供了更便捷、更高效的管理和使用体验。 综上所述,校园超市商品信息管理系统课程设计是一项旨在提升学生综合能力和实践技能的重要教学活动。通过此次设计,学生不仅深化了对程序设计基础知识的理解,还培养了解决实际问题的能力和团队合作精神。这一过程将为学生未来的专业发展提供坚实基础,使其在实际工作中能够胜任更多挑战。
recommend-type

"互动学习:行动中的多样性与论文攻读经历"

多样性她- 事实上SCI NCES你的时间表ECOLEDO C Tora SC和NCESPOUR l’Ingén学习互动,互动学习以行动为中心的强化学习学会互动,互动学习,以行动为中心的强化学习计算机科学博士论文于2021年9月28日在Villeneuve d'Asq公开支持马修·瑟林评审团主席法布里斯·勒菲弗尔阿维尼翁大学教授论文指导奥利维尔·皮耶昆谷歌研究教授:智囊团论文联合主任菲利普·普雷教授,大学。里尔/CRISTAL/因里亚报告员奥利维耶·西格德索邦大学报告员卢多维奇·德诺耶教授,Facebook /索邦大学审查员越南圣迈IMT Atlantic高级讲师邀请弗洛里安·斯特鲁布博士,Deepmind对于那些及时看到自己错误的人...3谢谢你首先,我要感谢我的两位博士生导师Olivier和Philippe。奥利维尔,"站在巨人的肩膀上"这句话对你来说完全有意义了。从科学上讲,你知道在这篇论文的(许多)错误中,你是我可以依
recommend-type

实现实时监控告警系统:Kafka与Grafana整合

![实现实时监控告警系统:Kafka与Grafana整合](https://imgconvert.csdnimg.cn/aHR0cHM6Ly9tbWJpei5xcGljLmNuL21tYml6X2pwZy9BVldpY3ladXVDbEZpY1pLWmw2bUVaWXFUcEdLT1VDdkxRSmQxZXB5R1lxaWNlUjA2c0hFek5Qc3FyRktudFF1VDMxQVl3QTRXV2lhSWFRMEFRc0I1cW1ZOGcvNjQw?x-oss-process=image/format,png) # 1.1 Kafka集群架构 Kafka集群由多个称为代理的服务器组成,这
recommend-type

写一个python代码遍历excel中的工作表,并提取每个工作表中的数据

好的,以下是Python代码示例: ``` import openpyxl # 打开Excel文件 workbook = openpyxl.load_workbook('example.xlsx') # 获取所有工作表名 worksheet_names = workbook.sheetnames # 遍历工作表并提取数据 for worksheet_name in worksheet_names: worksheet = workbook[worksheet_name] for row in worksheet.iter_rows(values_only=True):