小编Mis*_*sha的帖子

运行时错误:训练结束时 CUDA 内存不足,并且不保存模型;火炬

我在数据科学和 pytorch 方面没有那么丰富的经验,并且我在实现至少任何东西方面都遇到了问题(目前我正在为分割任务制作一个神经网络)。存在某种内存问题,尽管它没有任何意义 - 每个纪元占用的内存都比上升时要少得多

import torch
from torch import nn
from torch.autograd import Variable
from torch.nn import Linear, ReLU6, CrossEntropyLoss, Sequential, Conv2d, MaxPool2d, Module, Softmax, Softplus ,BatchNorm2d, Dropout, ConvTranspose2d
import torch.nn.functional as F
from torch.nn import LeakyReLU,Tanh
from torch.optim import Adam, SGD
import numpy as np
import cv2 as cv
def train(epoch,model,criterion, x_train, y_train, loss_val):
    model.train()
    tr_loss = 0
    # getting the training set
    x_train, y_train = Variable(x_train), Variable(y_train)
    # converting the data into GPU format

    # clearing the …
Run Code Online (Sandbox Code Playgroud)

python pytorch

5
推荐指数
1
解决办法
3100
查看次数

标签 统计

python ×1

pytorch ×1