点此进入CSDN

点此添加QQ好友 加载失败时会显示




上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 23 下一页
摘要: from torchvision.datasets import MNIST # import torchvision # torchvision.datasets. #准备数据集 mnist = MNIST(root="./mnist",train=True,download=True) prin 阅读全文
posted @ 2020-02-15 17:32 高颜值的殺生丸 阅读(1233) 评论(0) 推荐(0) 编辑
摘要: import torch from torch.utils.data import Dataset,DataLoader class SmsDataset(Dataset): def __init__(self): self.file_path = "./SMSSpamCollection" sel 阅读全文
posted @ 2020-02-14 16:42 高颜值的殺生丸 阅读(440) 评论(0) 推荐(0) 编辑
摘要: 实验代码 import torch import torch.nn as nn #y = wx + b class MyModel(nn.Module): def __init__(self): super(MyModel,self).__init__() #自定义代码 # self.w = tor 阅读全文
posted @ 2020-02-12 19:34 高颜值的殺生丸 阅读(525) 评论(0) 推荐(0) 编辑
摘要: import torch import matplotlib.pyplot as plt learning_rate = 0.1 #准备数据 #y = 3x +0.8 x = torch.randn([500,1]) y_true = 3*x + 0.8 #计算预测值 w = torch.rand( 阅读全文
posted @ 2020-02-12 17:37 高颜值的殺生丸 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 前项计算1 import torch # (3*(x+2)^2)/4 #grad_fn 保留计算的过程 x = torch.ones([2,2],requires_grad=True) print(x) y = x+2 print(y) z = 3*y.pow(2) print(z) out = z 阅读全文
posted @ 2020-02-12 16:56 高颜值的殺生丸 阅读(513) 评论(0) 推荐(0) 编辑
摘要: import torch import numpy as np device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") x = torch.tensor(np.arange(15).reshape(3,5)) i 阅读全文
posted @ 2020-02-12 16:11 高颜值的殺生丸 阅读(1456) 评论(0) 推荐(0) 编辑
摘要: import torch import numpy as np a = torch.tensor([[[1]]]) #只有一个数据的时候,获取其数值 print(a.item()) #tensor转化为nparray b = a.numpy() print(b,type(b),type(a)) #获 阅读全文
posted @ 2020-02-10 22:22 高颜值的殺生丸 阅读(2127) 评论(0) 推荐(0) 编辑
摘要: import torch import numpy as np print(torch.tensor([1,2,3])) print(torch.tensor(np.arange(15).reshape(3,5))) print(torch.empty([3,4])) print(torch.one 阅读全文
posted @ 2020-02-10 21:51 高颜值的殺生丸 阅读(622) 评论(0) 推荐(0) 编辑
摘要: 数据的读取 import tensorflow as tf from tensorflow.python import keras from tensorflow.python.keras.preprocessing.image import ImageDataGenerator class Tra 阅读全文
posted @ 2020-02-06 00:06 高颜值的殺生丸 阅读(612) 评论(0) 推荐(0) 编辑
摘要: from tensorflow.python.keras.applications.vgg16 import VGG16,preprocess_input,decode_predictions from tensorflow.python.keras.preprocessing.image impo 阅读全文
posted @ 2020-02-03 20:57 高颜值的殺生丸 阅读(530) 评论(0) 推荐(0) 编辑
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 23 下一页

作者信息

昵称:

刘新宇

园龄:4年6个月


粉丝:1209


QQ:522414928