赞
踩
- import torch
- if torch.cuda.is_available():
- torch.set_default_tensor_type(torch.cuda.FloatTensor)
- import torch.nn as nn
- import torch.nn.functional as F
- import torch.optim as optim
- from torchvision import datasets, transforms
-
- import syft as sy # <-- NEW: import the Pysyft library
-
- """
- Part 06 - Federated Learning on MNIST using a CNN
- http://localhost:8888/notebooks/git-home/github/PySyft/examples/tutorials/Part%2006%20-%20Federated%20Learning%20on%20MNIST%20using%20a%20CNN.ipynb
- """
-
- """
- 本例演示联邦学习CNN
- """
- class Arguments():
- def __init__(self):
- self.batch_size = 64
- self.test_batch_size = 1000
- self.epochs = 10
- self.lr = 0.01
- self.momentum = 0.5
- self.no_cuda = False
- self.seed = 1
- self.log_interval = 30
- self.save_model = False
-
- #pysyft的hook
- hook = sy.TorchHook(torch)

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。