-
Notifications
You must be signed in to change notification settings - Fork 615
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose Tensors types stubs in nvidia.dali.tensors module (#5153)
Base for the Python Tensor and TensorList types interface files, generated using stubgen (for `nvidia.dali.backend_impl` module) and inserted as `nvidia.dali.tensors`. As those types are generated in the backend, this is needed for tools like intellsense and mypy (working on static information) to work. C-based types (or types not guaranteed to be present, like np.array), are removed from signatures and left as a comment or replaced with Any. Additionally, the `__module__` for Tensor types is adjusted to `nvidia.dali.tensors` on the backend level. It allows pybind to generate the documentation pointing to the desired module, rather than the `backend_impl` one. We still have stubs which allow to find the Tensor types in the `backend` and `backend_impl` modules, keeping the backward compatibility. Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
- Loading branch information
Showing
7 changed files
with
471 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from nvidia.dali.tensors import TensorCPU as TensorCPU | ||
from nvidia.dali.tensors import TensorGPU as TensorGPU | ||
from nvidia.dali.tensors import TensorListCPU as TensorListCPU | ||
from nvidia.dali.tensors import TensorListGPU as TensorListGPU |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from nvidia.dali.tensors import TensorCPU as TensorCPU | ||
from nvidia.dali.tensors import TensorGPU as TensorGPU | ||
from nvidia.dali.tensors import TensorListCPU as TensorListCPU | ||
from nvidia.dali.tensors import TensorListGPU as TensorListGPU |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.