This commit is contained in:
Shital Shah 2019-05-29 00:35:02 -07:00
Родитель 8097818b75
Коммит 485b0235ba
4 изменённых файлов: 43 добавлений и 3 удалений

Просмотреть файл

@ -8,7 +8,7 @@ with open("README.md", "r") as fh:
setuptools.setup(
name="tensorwatch",
version="0.8.3",
version="0.8.4",
author="Shital Shah",
author_email="shitals@microsoft.com",
description="Interactive Realtime Debugging and Visualization for AI",
@ -24,6 +24,6 @@ setuptools.setup(
),
include_package_data=True,
install_requires=[
'matplotlib', 'numpy', 'pyzmq', 'plotly', 'torchstat', 'receptivefield', 'ipywidgets', 'sklearn', 'nbformat'
'matplotlib', 'numpy', 'pyzmq', 'plotly', 'torchstat', 'receptivefield', 'ipywidgets', 'sklearn', 'nbformat', 'skimage'
]
)

Просмотреть файл

@ -33,6 +33,7 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="tensorwatch\receptive_field\__init__.py" />
<Compile Include="tensorwatch\saliency\lime\wrappers\generic_utils.py" />
<Compile Include="tensorwatch\stream_union.py">
<SubType>Code</SubType>
</Compile>

Просмотреть файл

@ -0,0 +1,39 @@
import sys
import inspect
import types
def has_arg(fn, arg_name):
"""Checks if a callable accepts a given keyword argument.
Args:
fn: callable to inspect
arg_name: string, keyword argument name to check
Returns:
bool, whether `fn` accepts a `arg_name` keyword argument.
"""
if sys.version_info < (3,):
if isinstance(fn, types.FunctionType) or isinstance(fn, types.MethodType):
arg_spec = inspect.getargspec(fn)
else:
try:
arg_spec = inspect.getargspec(fn.__call__)
except AttributeError:
return False
return (arg_name in arg_spec.args)
elif sys.version_info < (3, 6):
arg_spec = inspect.getfullargspec(fn)
return (arg_name in arg_spec.args or
arg_name in arg_spec.kwonlyargs)
else:
try:
signature = inspect.signature(fn)
except ValueError:
# handling Cython
signature = inspect.signature(fn.__call__)
parameter = signature.parameters.get(arg_name)
if parameter is None:
return False
return (parameter.kind in (inspect.Parameter.POSITIONAL_OR_KEYWORD,
inspect.Parameter.KEYWORD_ONLY))

Просмотреть файл

@ -1,5 +1,5 @@
import types
from lime.utils.generic_utils import has_arg
from .generic_utils import has_arg
from skimage.segmentation import felzenszwalb, slic, quickshift