Exemplo n.º 1
0
import fedflow_test

import os

import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torchvision.datasets import mnist
from torchvision.transforms import transforms

from fedflow import Task, TaskGroup, FedFlow
from fedflow.config import Config
from fedflow.utils.trainer.supervised_trainer import SupervisedTrainer

Config.set_property("debug", True)
Config.set_property("scheduler.interval", 2)

datasets_path = os.path.join(os.path.abspath("."), "datasets")


class Net(nn.Module):
    def __init__(self):
        super(Net, self).__init__()
        self.conv1 = nn.Conv2d(1, 20, 5, 1)
        self.conv2 = nn.Conv2d(20, 50, 5, 1)
        self.fc1 = nn.Linear(4 * 4 * 50, 500)
        self.fc2 = nn.Linear(500, 10)
        self.softmax = nn.Softmax(dim=1)

    def forward(self, x):
        x = F.relu(self.conv1(x))
Exemplo n.º 2
0
 def test_modify(self):
     Config.set_property("utilization-limit.cpu", 0.5)
     self.assertEqual(Config.get_property("utilization-limit.cpu"), 0.5)