Skip to content

Shredder.ipynb #8

@ghost

Description

So sorry to bother you. I have some questions.
In Shredder.ipynb, the class SplitNN is not the subclass of nn.Module, and also does not define the attribute of train. So why there is a code of splitnn.train() in first line of nineteenth block, aslo the questions is the same as splitnn.zero_grads(),splitnn.backward().
The code and the reason of fault is as following.
THX
`splitnn.train()
for epoch in range(3):
epoch_loss = 0
epoch_outputs = []
epoch_labels = []
for i, data in enumerate(victim_train_dataloader):
splitnn.zero_grads()
inputs, labels = data
inputs = inputs.to(device)
labels = labels.to(device)

    outputs = splitnn(inputs)
    loss = criterion(outputs, labels)
    loss.backward()
    epoch_loss += loss.item() / len(victim_train_dataloader.dataset)
    
    epoch_outputs.append(outputs)
    epoch_labels.append(labels)
    
    splitnn.backward()
    splitnn.step()
    
print(epoch_loss, accuracy(torch.cat(epoch_labels),
                            torch.cat(epoch_outputs)))`

`---->Shredder.ipynb#ch0000013vscode-remote?line=0) splitnn.train()
Shredder.ipynb#ch0000013vscode-remote?line=1) for epoch in range(3):
Shredder.ipynb#ch0000013vscode-remote?line=2) epoch_loss = 0

AttributeError: 'SplitNN' object has no attribute 'train'`

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