persephone-tools / tensorflow-stubs Goto Github PK
View Code? Open in Web Editor NEWType stubs for the tensorflow library
License: MIT License
Type stubs for the tensorflow library
License: MIT License
$ pipenv install
Pipfile.lock (b9c44e) out of date, updating to (ec4b23)...
Locking [dev-packages] dependencies...
Then it gets stuck for quite a while.
See https://github.com/numpy/numpy-stubs/tree/master/tests for inspiration
We need some verified working Tensorflow code to test the stubs against.
Given that Tensor
is a foundational piece we need to get good stubs for it. Currently there is only this:
tensorflow-stubs/tensorflow-stubs/__init__.pyi
Lines 81 to 82 in f000ae4
With no type stubs for __init__
or anything else. The coverage here needs to be improved.
As you can see here https://github.com/tensorflow/tensorflow/blob/0e53c66f338a60be5ea348fdeb7b19e5b579971f/tensorflow/python/framework/ops.py#L193 there's a common base class called _TensorLike
for Tensor
and SparseTensor
, should we create a type stub for the base class?
When run outside the test runner you get this:
$ mypy tests/fail/fail_example.py
tests/fail/fail_example.py:6: error: No overload variant of "int" matches argument type "Dict[Any, Any]"
tests/fail/fail_example.py:6: note: Possible overload variant:
tests/fail/fail_example.py:6: note: def int(self, x: Union[str, bytes, SupportsInt] = ...) -> int
tests/fail/fail_example.py:6: note: <1 more non-matching overload not shown>
When run in the test runner the lines starting with "note" cause problems with the tests.
if "# E:" in target_line:
marker = target_line.split("# E:")[-1].strip()
assert lineno in errors, f'Extra error "{marker}"'
assert marker in errors[lineno]
else:
> pytest.fail(f'Error {repr(errors[lineno])} not found')
E Failed: Error 'tests/fail/fail_example.py:6: note: def int(self, x: Union[str, unicode, bytearray], base: int = ...) -> int' not found
Would be good to deal with data shape information
Hi,
Is this project still being developed? If so, I would be happy to help out. I've started looking at solving the testing, but is there anything I need to do for submitting a pull request? @shuttle1987
Currently SparseTensor
does not have a type stub.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.