Skip to content

why use the drnet-py can't accomplish the train result compare with lua train file? #6

@Feifannaner

Description

@Feifannaner

Thanks for you python code .
when I use the lua file to train the single number moving mnist data ,the scene desciminator can accomplish the 98%+ train result. however, when i run it using the python files ,it cannot accomplish the same result.
train_issue
could you explain it ? or there is something wrong with the code? @edenton

`
def train_scene_discriminator(x):
netC.zero_grad()
target = torch.cuda.FloatTensor(opt.batch_size,1).to(device)
import random
offset1 = random.randint(0,opt.max_step-1)$
offset2 = random.randint(0,opt.max_step-1)$
x1 = x[offset1].to(device)$
x2 = x[offset2].to(device)$
#(bs,t,w,h,n)$

h_p1 = netEP(x1).detach()$
h_p2 = netEP(x2).detach()$
half = int(opt.batch_size/2)$
rp = torch.randperm(half).to(device)$
#h_p2[:half] = h_p2[rp]$
h_p2[half:] = h_p2[opt.batch_size/2+rp]$
target[:half] = 1$
target[half:] = 0$
out = netC([h_p1, h_p2])$
bce = bce_criterion(out, Variable(target))$
bce.backward()$
optimizerC.step()$

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions