Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation to functional API (all fn.*) + New documentation layout #2653

Merged
merged 18 commits into from
Feb 22, 2021

Conversation

jantonguirao
Copy link
Contributor

@jantonguirao jantonguirao commented Feb 2, 2021

Signed-off-by: Joaquin Anton [email protected]

Why we need this PR?

Pick one, remove the rest

  • Changes of documentation, removing the "experimental" note about functional API and adding proper documentation to it

What happened in this PR?

Fill relevant points, put NA otherwise. Replace anything inside []

  • What solution was applied:

    • Replaced documentation of functional API wrappers (currently a link to operator documentation page) to contain the body of the documentation instead
    • It adds operator documentation to functional API wrappers
    • It creates a new layout for the documentation, some sections have been expanded in the navigation bar and captions are used for delimitation
    • Getting started section has been reduced by moving advanced topics to a separate section (for instance, compiling from source)
    • Functional API documentation is now the main "Operations" documentation and the object API (ops.*) is marked as Legacy
    • A new table has been added, mapping the functional API operations to the legacy name (ops.*)
  • Affected modules and functionalities:
    Documentation

  • Key points relevant for the review:
    Documentation

  • Validation and testing:
    N/A

  • Documentation (including examples):
    *Documentation of fn *

JIRA TASK: [DALI-1823]

@jantonguirao
Copy link
Contributor Author

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [2037447]: BUILD STARTED

@jantonguirao
Copy link
Contributor Author

image

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [2037447]: BUILD PASSED

Signed-off-by: Joaquin Anton <[email protected]>
@jantonguirao
Copy link
Contributor Author

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [2059546]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [2059546]: BUILD PASSED

Signed-off-by: Joaquin Anton <[email protected]>
Signed-off-by: Joaquin Anton <[email protected]>
Signed-off-by: Joaquin Anton <[email protected]>
:meth:`nvidia.dali.pipeline.Pipeline.feed_input` and
.DocStr(R"code(Allows externally provided data to be passed as an input to the pipeline.

See :meth:`nvidia.dali.ops.ExternalSource.__init__`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This leads to strange link from fn API to the legacy one. Maybe we should use only fn here?

Signed-off-by: Joaquin Anton <[email protected]>
Comment on lines 6 to 7
DALI's operations or "functions" are contained in the ``dali.fn`` module and their names are snake-cased
(for example ``dali.fn.image_decoder``).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need that here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example or the whole sentence?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole sentence. Like we don't describe the naming convention in the legacy page. It has only value (IMHO) when you compare the legacy with the fn API. In this page we don't have to compare these two approaches.

docs/operations_table.py Outdated Show resolved Hide resolved
Signed-off-by: Joaquin Anton <[email protected]>
@jantonguirao jantonguirao changed the title Add operator documentation to functional API (all fn.*) Add documentation to functional API (all fn.*) + New documentation layout Feb 11, 2021
@jantonguirao
Copy link
Contributor Author

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [2067617]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [2067617]: BUILD PASSED

@szalpal
Copy link
Member

szalpal commented Feb 12, 2021

One minor comment from my side:
I feel, that the "CPU" and "GPU" in the table are hard to distinguish, especially when there's a mix like this:
image

How about making GPU bold?

Signed-off-by: Joaquin Anton <[email protected]>
Signed-off-by: Joaquin Anton <[email protected]>
Copy link
Contributor

@klecki klecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly ok, but:

  • I would consider adding one or two sentences about the DataNodes in the operations (actual type of input and return value) and their use in pipeline definition.
  • I would replace all mentions of nvidia.dali.ops. in the Operations and replace them with nvidia.dali.fn (you would need to adjust docstrings).
  • There is off by one error.
  • I had some comments to the naming of several sections, but it's rather minor.

docs/index.rst Outdated
@@ -24,24 +24,48 @@ This library is open sourced and it is available in the `NVIDIA GitHub repositor
.. toctree::
:hidden:

Documentation home <self>
Documentation Home <self>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a preference, but I would consider removing it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we remove it would be impossible to navigate to the documentation home (no link in the navigation bar)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are at least two other home page links. But that's just my preference.

Sharding
--------
========
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: I feel better, when the top-level navigation leads to the same page, but are distinct sub-pages.

C++ API
-------
=======
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this section still doesn't deserve to be a top-level link in our docs.

@@ -243,8 +190,60 @@ When this occurs, use the first formula.
To address these challenges, use the ``reader_name`` parameter and allow the iterator
handle the details.


Pipeline Run Methods
====================
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

ret += _numpydoc_formatter(input_name, input_type_str, dox, True) + "\n"
elif extra_opt_args > 1:
input_type_str = "TensorList"
input_name = f"input[{schema.MinNumInput()}..{schema.MaxNumInput()}]"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
input_name = f"input[{schema.MinNumInput()}..{schema.MaxNumInput()}]"
input_name = f"input[{schema.MinNumInput()}..{schema.MaxNumInput()-1}]"


- |mxnet link|_ ``mxnet-cu100`` or later.
- |pytorch link|_ or later.
- |tf link|_ or later.


Installation
^^^^^^^^^^^^
NGC Containers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NGC Containers
DALI in NGC Containers

.. note::
----

pip
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm missing something like: install DALI releases or official DALI wheels.
pip lacks the meaning in the navigation on the right.


Nightly and weekly release channels
-----------------------------------
pip (Nightly and weekly releases)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pip (Nightly and weekly releases)
pip - Nightly and weekly releases

Here we have the nightly and weekly releases mentioned.

pip install --extra-index-url https://developer.download.nvidia.com/compute/redist/weekly nvidia-dali-tf-plugin-weekly-cuda110


pip (DALI 0.22 and lower)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pip (DALI 0.22 and lower)
pip - old/legacy DALI versions/legacy DALI packages

break
if m is not None and hasattr(m, op_name):
op_string = link_formatter.format(op = op_full_name, module = module_name)
fn_string = link_formatter.format(op = to_fn_name(op_full_name), module = module_name.replace('.ops', '.fn'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add to_fn_module, I see that module_name.replace('.ops', '.fn') appears several times in this file.

Signed-off-by: Joaquin Anton <[email protected]>
Signed-off-by: Joaquin Anton <[email protected]>
Signed-off-by: Joaquin Anton <[email protected]>

- | Simple run method, which runs the computations and returns the results.
| This option corresponds to the :meth:`nvidia.dali.types.PipelineAPIType.BASIC` API type.
- | :meth:`nvidia.dali.pipeline.Pipeline.schedule_runs`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- | :meth:`nvidia.dali.pipeline.Pipeline.schedule_runs`,
- | :meth:`nvidia.dali.pipeline.Pipeline.schedule_run`,

Signed-off-by: Joaquin Anton <[email protected]>
Signed-off-by: Joaquin Anton <[email protected]>
@jantonguirao
Copy link
Contributor Author

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [2079096]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [2079096]: BUILD FAILED

Signed-off-by: Joaquin Anton <[email protected]>
@jantonguirao
Copy link
Contributor Author

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [2079410]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [2079410]: BUILD PASSED

^^^^^^^^^^^^^^^^^^^^^^^^

DALI allows you to use regular Python arithmetic operations and other mathematical functions in
the :meth:`~nvidia.dali.pipeline.Pipeline.define_graph` method on the values that are returned
the :meth:`~nvidia.dali.Pipeline.define_graph` method on the values that are returned
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we mention define_graph here?

return longest_str

op_name_max_len = len(longest_fn_string())
name_bar = op_name_max_len * '='
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see it used anywhere.

longest_str = fn_string
return longest_str

op_name_max_len = len(longest_fn_string())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be in a global scope?

@jantonguirao jantonguirao merged commit c5cf044 into NVIDIA:master Feb 22, 2021
@JanuszL JanuszL mentioned this pull request May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants