Commit 94d8b409 by 前钰

Upload New File

parent 007370b7
import torch
import torch
from torch import nn
from torch.autograd import Variable
import torchvision.transforms as tfs
from torch.utils.data import DataLoader, sampler
from torchvision.datasets import MNIST
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from utils import NOISE_DIM
class build_dc_generator(nn.Module):
def __init__(self, noise_dim=NOISE_DIM):
super(build_dc_generator, self).__init__()
self.fc = nn.Sequential(
)
self.conv = nn.Sequential(
)
def forward(self, x):
x = x.view(x.shape[0], 128, 7, 7) # reshape 通道是 128,大小是 7x7
return x
class build_dc_classifier(nn.Module):
def __init__(self):
super(build_dc_classifier, self).__init__()
self.conv = nn.Sequential(
)
self.fc = nn.Sequential(
)
def forward(self, x):
x = x.view(x.shape[0], -1)
return x
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment