提交 20b67b29 编写于 作者: M Megvii Engine Team

ci(python): add format and lint check for python

GitOrigin-RevId: d8d106b92720b2b5c7231ff9930bea3c54ddb409
上级 62b0c6cd
......@@ -114,7 +114,7 @@ def max_pool2d(
:param stride: The stride of the window. If not provided, its value is set to ``kernel_size``.
Default: None
:param padding: Implicit zero padding to be added on both sides. Default: 0
Refer to :class:`~.MaxPool2d` for more information.
"""
......@@ -615,7 +615,7 @@ def interpolate(
:param mode: interpolation methods, acceptable values are:
'bilinear'(default), 'linear', 'nearest' (todo), 'cubic' (todo), 'area' (todo)
Examples:
......@@ -743,7 +743,9 @@ def dropout(inp: Tensor, drop_prob: float, rescale: bool = True) -> Tensor:
import numpy as np
from megengine import tensor
import megengine.functional as F
from megengine.random import manual_seed
manual_seed(0)
data = tensor(np.ones(10, dtype=np.float32))
out = F.dropout(data, 1./3.)
print(out.numpy())
......@@ -767,7 +769,7 @@ def dropout(inp: Tensor, drop_prob: float, rescale: bool = True) -> Tensor:
@wrap_io_tensor
def identity(inp: Tensor) -> Tensor:
"""applies an identity transform to the input tensor.
:param inp: The input tensor
"""
return mgb.opr.identity(inp)
......
......@@ -42,13 +42,14 @@ def gaussian(
import megengine as mge
import megengine.random as rand
rand.manual_seed(0)
x = rand.gaussian((2, 2), mean=0, std=1)
print(x.numpy())
.. testoutput::
[[ 0.2925366 -0.718359 ]
[ 0.09999694 -0.3931978 ]]
[[-0.20235455 -0.6959438 ]
[-1.4939808 -1.5824696 ]]
"""
comp_node, comp_graph = _use_default_if_none(comp_node, comp_graph)
......@@ -78,13 +79,14 @@ def uniform(
import megengine as mge
import megengine.random as rand
rand.manual_seed(0)
x = rand.uniform((2, 2))
print(x.numpy())
.. testoutput::
[[0.74021935 0.9209938 ]
[0.03902049 0.9689629 ]]
[[0.76901674 0.70496535]
[0.09365904 0.62957656]]
"""
comp_node, comp_graph = _use_default_if_none(comp_node, comp_graph)
......
black==19.10b0
isort==4.3.21
pylint==2.4.3
mypy==0.750
pytest==5.3.0
pytest-sphinx==0.2.2
numpy>=1.17
opencv-python
pyarrow
requests
tabulate
tqdm
redispy
......@@ -55,6 +55,13 @@ package_data += [
os.path.join('module', 'pytorch', 'torch_mem_fwd.cpp')
]
with open('requires.txt') as f:
requires = f.read().splitlines()
with open('requires-style.txt') as f:
requires_style = f.read().splitlines()
with open('requires-test.txt') as f:
requires_test = f.read().splitlines()
setup_kwargs = dict(
name=package_name,
version=__version__,
......@@ -67,29 +74,10 @@ setup_kwargs = dict(
'megengine': package_data,
},
ext_modules=[PrecompiledExtesion('megengine._internal._mgb')],
install_requires=[
'numpy>=1.17',
'opencv-python',
'pyarrow',
'requests',
'tabulate',
'tqdm',
],
install_requires=requires,
extras_require={
'dev': [
'black==19.10b0',
'isort==4.3.21',
'pylint==2.4.3',
'mypy==0.750',
'pytest==5.3.0',
'pytest-sphinx==0.2.2',
],
'data': [
'scipy',
],
'ci': [
'pytest==5.3.0',
],
'dev': [*requires_style, *requires_test],
'ci': requires_test,
},
cmdclass={'build_ext': build_ext},
)
......
#!/bin/bash -e
pushd $(dirname "${BASH_SOURCE[0]}")/.. >/dev/null
pytest -xv -m 'not internet'\
pytest -xv -m 'not internet' \
--ignore test/unit/module/test_pytorch.py \
--ignore test/pytorch_comparison \
--ignore test/unit/hub/test_hub.py \
--ignore test/unit/data \
--ignore test/integration/manual \
--ignore megengine/docs/ \
--ignore megengine/module/pytorch \
megengine test
popd >/dev/null
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册