def on_train_start(self, *_, **__):
        from logging import DEBUG

        default_logger.setLevel(DEBUG)
示例#2
0
文件: test_pool.py 项目: iffiX/machin
from logging import DEBUG
from machin.parallel.pool import Pool, P2PPool, CtxPool, ThreadPool, CtxThreadPool
from machin.utils.logging import default_logger as logger
from test.util_fixtures import *
from test.util_platforms import linux_only

import dill
import pytest
import torch as t

# enable pool logging
logger.setLevel(DEBUG)


def init_func(*_):
    print("Hello")


def func(x):
    return t.sum(x * 2)


def func2(x, y):
    return t.sum(x + y)


class TestPool:
    pool_impl = Pool

    def test_apply(self):
        pool = self.pool_impl(processes=2)