From 49b79206bc423de1e7fae2bf4971cb6ec4e7c038 Mon Sep 17 00:00:00 2001 From: Roi Bar-Holem Date: Tue, 7 May 2024 16:33:42 +0300 Subject: [PATCH 01/11] Update __init__.py --- sony_custom_layers/pytorch/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sony_custom_layers/pytorch/__init__.py b/sony_custom_layers/pytorch/__init__.py index ac1c71b..79b9691 100644 --- a/sony_custom_layers/pytorch/__init__.py +++ b/sony_custom_layers/pytorch/__init__.py @@ -31,13 +31,13 @@ def load_custom_ops(load_ort: bool = False, ort_session_ops: Optional['ort.SessionOptions'] = None) -> Optional['ort.SessionOptions']: """ + Note: this must be run before inferring a model with SCL in onnxruntime. To trigger ops registration in torch any import from sony_custom_layers.pytorch + is technically sufficient, In which case this is just a dummy API to prevent unused import (e.g. when loading exported pt2 model) + Load custom ops for torch and, optionally, for onnxruntime. If 'load_ort' is True or 'ort_session_ops' is passed, registers the custom ops implementation for onnxruntime, and sets up the SessionOptions object for onnxruntime session. - Note: this is a must for onnxruntime. To trigger torch ops registration any import from sony_custom_layers.pytorch - is technically sufficient. This is just a dummy api to prevent unused import (e.g. when loading exported pt2 model) - Args: load_ort: whether to register the custom ops for onnxruntime. ort_session_ops: SessionOptions object to register the custom ops library on. If None (and 'load_ort' is True), From e164ddeaa6a9a14875cde30ef2b72365e8be2860 Mon Sep 17 00:00:00 2001 From: Roi Bar-Holem Date: Tue, 7 May 2024 16:39:57 +0300 Subject: [PATCH 02/11] Update __init__.py --- sony_custom_layers/pytorch/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sony_custom_layers/pytorch/__init__.py b/sony_custom_layers/pytorch/__init__.py index 79b9691..babc590 100644 --- a/sony_custom_layers/pytorch/__init__.py +++ b/sony_custom_layers/pytorch/__init__.py @@ -31,9 +31,10 @@ def load_custom_ops(load_ort: bool = False, ort_session_ops: Optional['ort.SessionOptions'] = None) -> Optional['ort.SessionOptions']: """ - Note: this must be run before inferring a model with SCL in onnxruntime. To trigger ops registration in torch any import from sony_custom_layers.pytorch - is technically sufficient, In which case this is just a dummy API to prevent unused import (e.g. when loading exported pt2 model) - + Note: this must be run before inferring a model with SCL in onnxruntime. + To trigger ops registration in torch any import from sony_custom_layers.pytorch is technically sufficient, + In which case this is just a dummy API to prevent unused import (e.g. when loading exported pt2 model) + Load custom ops for torch and, optionally, for onnxruntime. If 'load_ort' is True or 'ort_session_ops' is passed, registers the custom ops implementation for onnxruntime, and sets up the SessionOptions object for onnxruntime session. From 022f1fe401cb7ba9f714c072039f09f71dc72a44 Mon Sep 17 00:00:00 2001 From: "GitHub Actions [Bot]" Date: Tue, 7 May 2024 13:42:03 +0000 Subject: [PATCH 03/11] Update docs [Created by Github action] --- docs/sony_custom_layers/pytorch.html | 227 ++++++++++++++------------- 1 file changed, 115 insertions(+), 112 deletions(-) diff --git a/docs/sony_custom_layers/pytorch.html b/docs/sony_custom_layers/pytorch.html index 45f8a18..f92193a 100644 --- a/docs/sony_custom_layers/pytorch.html +++ b/docs/sony_custom_layers/pytorch.html @@ -120,61 +120,62 @@

31def load_custom_ops(load_ort: bool = False, 32 ort_session_ops: Optional['ort.SessionOptions'] = None) -> Optional['ort.SessionOptions']: 33 """ -34 Load custom ops for torch and, optionally, for onnxruntime. -35 If 'load_ort' is True or 'ort_session_ops' is passed, registers the custom ops implementation for onnxruntime, and -36 sets up the SessionOptions object for onnxruntime session. +34 Note: this must be run before inferring a model with SCL in onnxruntime. +35 To trigger ops registration in torch any import from sony_custom_layers.pytorch is technically sufficient, +36 In which case this is just a dummy API to prevent unused import (e.g. when loading exported pt2 model) 37 -38 Note: this is a must for onnxruntime. To trigger torch ops registration any import from sony_custom_layers.pytorch -39 is technically sufficient. This is just a dummy api to prevent unused import (e.g. when loading exported pt2 model) -40 -41 Args: -42 load_ort: whether to register the custom ops for onnxruntime. -43 ort_session_ops: SessionOptions object to register the custom ops library on. If None (and 'load_ort' is True), -44 creates a new object. -45 -46 Returns: -47 SessionOptions object if ort registration was requested, otherwise None -48 -49 Example: -50 *ONNXRuntime*: -51 ``` -52 import onnxruntime as ort -53 from sony_custom_layers.pytorch import load_custom_ops -54 -55 so = load_custom_ops(load_ort=True) -56 session = ort.InferenceSession(model_path, sess_options=so) -57 session.run(...) -58 ``` -59 You can also pass your own SessionOptions object upon which to register the custom ops -60 ``` -61 load_custom_ops(ort_session_options=so) -62 ``` -63 -64 *PT2 model*:<br> -65 If sony_custom_layers.pytorch is already imported no action is needed. Otherwise, you can use: -66 -67 ``` -68 from sony_custom_layers.pytorch import load_custom_ops -69 load_custom_ops() -70 -71 prog = torch.export.load(model_path) -72 y = prog.module()(x) -73 ``` -74 """ -75 if load_ort or ort_session_ops: -76 validate_pip_requirements(requirements['torch_ort']) -77 -78 # trigger onnxruntime op registration -79 from .object_detection import nms_ort -80 -81 from onnxruntime_extensions import get_library_path -82 from onnxruntime import SessionOptions -83 ort_session_ops = ort_session_ops or SessionOptions() -84 ort_session_ops.register_custom_ops_library(get_library_path()) -85 return ort_session_ops -86 else: -87 # nothing really to do after import was triggered -88 return None +38 Load custom ops for torch and, optionally, for onnxruntime. +39 If 'load_ort' is True or 'ort_session_ops' is passed, registers the custom ops implementation for onnxruntime, and +40 sets up the SessionOptions object for onnxruntime session. +41 +42 Args: +43 load_ort: whether to register the custom ops for onnxruntime. +44 ort_session_ops: SessionOptions object to register the custom ops library on. If None (and 'load_ort' is True), +45 creates a new object. +46 +47 Returns: +48 SessionOptions object if ort registration was requested, otherwise None +49 +50 Example: +51 *ONNXRuntime*: +52 ``` +53 import onnxruntime as ort +54 from sony_custom_layers.pytorch import load_custom_ops +55 +56 so = load_custom_ops(load_ort=True) +57 session = ort.InferenceSession(model_path, sess_options=so) +58 session.run(...) +59 ``` +60 You can also pass your own SessionOptions object upon which to register the custom ops +61 ``` +62 load_custom_ops(ort_session_options=so) +63 ``` +64 +65 *PT2 model*:<br> +66 If sony_custom_layers.pytorch is already imported no action is needed. Otherwise, you can use: +67 +68 ``` +69 from sony_custom_layers.pytorch import load_custom_ops +70 load_custom_ops() +71 +72 prog = torch.export.load(model_path) +73 y = prog.module()(x) +74 ``` +75 """ +76 if load_ort or ort_session_ops: +77 validate_pip_requirements(requirements['torch_ort']) +78 +79 # trigger onnxruntime op registration +80 from .object_detection import nms_ort +81 +82 from onnxruntime_extensions import get_library_path +83 from onnxruntime import SessionOptions +84 ort_session_ops = ort_session_ops or SessionOptions() +85 ort_session_ops.register_custom_ops_library(get_library_path()) +86 return ort_session_ops +87 else: +88 # nothing really to do after import was triggered +89 return None @@ -482,71 +483,73 @@

Inherited Members
32def load_custom_ops(load_ort: bool = False,
 33                    ort_session_ops: Optional['ort.SessionOptions'] = None) -> Optional['ort.SessionOptions']:
 34    """
-35    Load custom ops for torch and, optionally, for onnxruntime.
-36    If 'load_ort' is True or 'ort_session_ops' is passed, registers the custom ops implementation for onnxruntime, and
-37    sets up the SessionOptions object for onnxruntime session.
+35    Note: this must be run before inferring a model with SCL in onnxruntime.
+36    To trigger ops registration in torch any import from sony_custom_layers.pytorch is technically sufficient,
+37    In which case this is just a dummy API to prevent unused import (e.g. when loading exported pt2 model)
 38
-39    Note: this is a must for onnxruntime. To trigger torch ops registration any import from sony_custom_layers.pytorch
-40    is technically sufficient. This is just a dummy api to prevent unused import (e.g. when loading exported pt2 model)
-41
-42    Args:
-43        load_ort: whether to register the custom ops for onnxruntime.
-44        ort_session_ops: SessionOptions object to register the custom ops library on. If None (and 'load_ort' is True),
-45                        creates a new object.
-46
-47    Returns:
-48        SessionOptions object if ort registration was requested, otherwise None
-49
-50    Example:
-51        *ONNXRuntime*:
-52            ```
-53            import onnxruntime as ort
-54            from sony_custom_layers.pytorch import load_custom_ops
-55
-56            so = load_custom_ops(load_ort=True)
-57            session = ort.InferenceSession(model_path, sess_options=so)
-58            session.run(...)
-59            ```
-60            You can also pass your own SessionOptions object upon which to register the custom ops
-61            ```
-62            load_custom_ops(ort_session_options=so)
-63            ```
-64
-65        *PT2 model*:<br>
-66            If sony_custom_layers.pytorch is already imported no action is needed. Otherwise, you can use:
-67
-68            ```
-69            from sony_custom_layers.pytorch import load_custom_ops
-70            load_custom_ops()
-71
-72            prog = torch.export.load(model_path)
-73            y = prog.module()(x)
-74            ```
-75    """
-76    if load_ort or ort_session_ops:
-77        validate_pip_requirements(requirements['torch_ort'])
-78
-79        # trigger onnxruntime op registration
-80        from .object_detection import nms_ort
-81
-82        from onnxruntime_extensions import get_library_path
-83        from onnxruntime import SessionOptions
-84        ort_session_ops = ort_session_ops or SessionOptions()
-85        ort_session_ops.register_custom_ops_library(get_library_path())
-86        return ort_session_ops
-87    else:
-88        # nothing really to do after import was triggered
-89        return None
+39    Load custom ops for torch and, optionally, for onnxruntime.
+40    If 'load_ort' is True or 'ort_session_ops' is passed, registers the custom ops implementation for onnxruntime, and
+41    sets up the SessionOptions object for onnxruntime session.
+42
+43    Args:
+44        load_ort: whether to register the custom ops for onnxruntime.
+45        ort_session_ops: SessionOptions object to register the custom ops library on. If None (and 'load_ort' is True),
+46                        creates a new object.
+47
+48    Returns:
+49        SessionOptions object if ort registration was requested, otherwise None
+50
+51    Example:
+52        *ONNXRuntime*:
+53            ```
+54            import onnxruntime as ort
+55            from sony_custom_layers.pytorch import load_custom_ops
+56
+57            so = load_custom_ops(load_ort=True)
+58            session = ort.InferenceSession(model_path, sess_options=so)
+59            session.run(...)
+60            ```
+61            You can also pass your own SessionOptions object upon which to register the custom ops
+62            ```
+63            load_custom_ops(ort_session_options=so)
+64            ```
+65
+66        *PT2 model*:<br>
+67            If sony_custom_layers.pytorch is already imported no action is needed. Otherwise, you can use:
+68
+69            ```
+70            from sony_custom_layers.pytorch import load_custom_ops
+71            load_custom_ops()
+72
+73            prog = torch.export.load(model_path)
+74            y = prog.module()(x)
+75            ```
+76    """
+77    if load_ort or ort_session_ops:
+78        validate_pip_requirements(requirements['torch_ort'])
+79
+80        # trigger onnxruntime op registration
+81        from .object_detection import nms_ort
+82
+83        from onnxruntime_extensions import get_library_path
+84        from onnxruntime import SessionOptions
+85        ort_session_ops = ort_session_ops or SessionOptions()
+86        ort_session_ops.register_custom_ops_library(get_library_path())
+87        return ort_session_ops
+88    else:
+89        # nothing really to do after import was triggered
+90        return None
 
-

Load custom ops for torch and, optionally, for onnxruntime. +

Note: this must be run before inferring a model with SCL in onnxruntime. +To trigger ops registration in torch any import from sony_custom_layers.pytorch is technically sufficient, +In which case this is just a dummy API to prevent unused import (e.g. when loading exported pt2 model)

+ +

Load custom ops for torch and, optionally, for onnxruntime. If 'load_ort' is True or 'ort_session_ops' is passed, registers the custom ops implementation for onnxruntime, and sets up the SessionOptions object for onnxruntime session.

-

Note: this is a must for onnxruntime. To trigger torch ops registration any import from sony_custom_layers.pytorch -is technically sufficient. This is just a dummy api to prevent unused import (e.g. when loading exported pt2 model)

-
Arguments:
    From 84e071fe2232202c1eadfaa62dbddd1097e9ff3e Mon Sep 17 00:00:00 2001 From: Roi Bar-Holem Date: Tue, 7 May 2024 16:51:16 +0300 Subject: [PATCH 04/11] --show-inherited-members false --- generate_docs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generate_docs.sh b/generate_docs.sh index f785606..ff61b33 100755 --- a/generate_docs.sh +++ b/generate_docs.sh @@ -29,9 +29,9 @@ fi echo Generating docs cd $ROOT -pdoc --docformat google -o $DOCS_DIR ./sony_custom_layers/{keras,pytorch} --no-include-undocumented --no-search +pdoc --docformat google -o $DOCS_DIR ./sony_custom_layers/{keras,pytorch} --no-include-undocumented --no-search --show-inherited-members false if [ "$ENV_DIR" ];then echo Removing $ENV_DIR rm -rf $ENV_DIR -fi \ No newline at end of file +fi From e838e9719037fef0fc0e47ef3db5310528ababfa Mon Sep 17 00:00:00 2001 From: Roi Bar-Holem Date: Tue, 7 May 2024 17:02:52 +0300 Subject: [PATCH 05/11] Update generate_docs.sh --- generate_docs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate_docs.sh b/generate_docs.sh index ff61b33..38148cc 100755 --- a/generate_docs.sh +++ b/generate_docs.sh @@ -29,7 +29,7 @@ fi echo Generating docs cd $ROOT -pdoc --docformat google -o $DOCS_DIR ./sony_custom_layers/{keras,pytorch} --no-include-undocumented --no-search --show-inherited-members false +pdoc --docformat google -o $DOCS_DIR ./sony_custom_layers/{keras,pytorch} --no-include-undocumented --no-search if [ "$ENV_DIR" ];then echo Removing $ENV_DIR From d6797fc0736d8b8e2b994745ce339c1a54352f97 Mon Sep 17 00:00:00 2001 From: Roi Bar-Holem Date: Tue, 7 May 2024 17:19:24 +0300 Subject: [PATCH 06/11] Create module.html.jinja2 --- pdoc/template/module.html.jinja2 | 289 +++++++++++++++++++++++++++++++ 1 file changed, 289 insertions(+) create mode 100644 pdoc/template/module.html.jinja2 diff --git a/pdoc/template/module.html.jinja2 b/pdoc/template/module.html.jinja2 new file mode 100644 index 0000000..9cdf3fe --- /dev/null +++ b/pdoc/template/module.html.jinja2 @@ -0,0 +1,289 @@ +{% extends "frame.html.jinja2" %} +{% block title %}{{ module.modulename }} API documentation{% endblock %} +{% block nav %} + {% block module_list_link %} + {% set parentmodule = ".".join(module.modulename.split(".")[:-1]) %} + {% if parentmodule and parentmodule in all_modules %} + + {% include "resources/box-arrow-in-left.svg" %} +   + {{- parentmodule -}} + + {% elif not root_module_name %} + + {% include "resources/box-arrow-in-left.svg" %} +   + Module Index + + {% endif %} + {% endblock %} + + {% block nav_title %} + {% if logo %} + {% if logo_link %}{% endif %} + + {% if logo_link %}{% endif %} + {% endif %} + {% endblock %} + + {% block search_box %} + {% if search and all_modules|length > 1 %} + {# we set a pattern here so that we can use the :valid CSS selector #} + + {% endif %} + {% endblock %} + + {% block nav_index %} + {% set index = module.docstring | to_markdown | to_html | attr("toc_html") %} + {% if index %} +

    Contents

    + {{ index | safe }} + {% endif %} + {% endblock %} + + {% block nav_submodules %} + {% if module.submodules %} +

    Submodules

    +
      + {% for submodule in module.submodules if is_public(submodule) | trim %} +
    • {{ submodule.taken_from | link(text=submodule.name) }}
    • + {% endfor %} +
    + {% endif %} + {% endblock %} + + {% block nav_members %} + {% if module.members %} +

    API Documentation

    + {{ nav_members(module.members.values()) }} + {% endif %} + {% endblock %} + + {% block nav_footer %} + {% if footer_text %} +
    {{ footer_text }}
    + {% endif %} + {% endblock %} + + {% block attribution %} + + built with pdocpdoc logo + + {% endblock %} +{% endblock nav %} +{% block content %} +
    + {% block module_info %} +
    + {% block edit_button %} + {% if edit_url %} + {% if "github.com" in edit_url %} + {% set edit_text = "Edit on GitHub" %} + {% elif "gitlab" in edit_url %} + {% set edit_text = "Edit on GitLab" %} + {% else %} + {% set edit_text = "Edit Source" %} + {% endif %} + {{ edit_text }} + {% endif %} + {% endblock %} + {{ module_name() }} + {{ docstring(module) }} + {{ view_source_state(module) }} + {{ view_source_button(module) }} + {{ view_source_code(module) }} +
    + {% endblock %} + {% block module_contents %} + {% for m in module.flattened_own_members if is_public(m) | trim %} +
    + {{ member(m) }} + {% if m.kind == "class" %} + {% for m in m.own_members if m.kind != "class" and is_public(m) | trim %} +
    + {{ member(m) }} +
    + {% endfor %} + {% endif %} +
    + {% endfor %} + {% endblock %} +
    + {% if mtime %} + {% include "livereload.html.jinja2" %} + {% endif %} + {% block search_js %} + {% if search and all_modules|length > 1 %} + {% include "search.html.jinja2" %} + {% endif %} + {% endblock %} +{% endblock content %} +{# +End of content, beginning of helper macros. +See https://pdoc.dev/docs/pdoc/render_helpers.html#DefaultMacroExtension for an explanation of defaultmacro. +#} +{% defaultmacro bases(cls) %} + {%- if cls.bases -%} + ( + {%- for base in cls.bases -%} + {{ base[:2] | link(text=base[2]) }} + {%- if loop.nextitem %}, {% endif %} + {%- endfor -%} + ) + {%- endif -%} +{% enddefaultmacro %} +{% defaultmacro default_value(var) -%} + {%- if var.default_value_str %} + = + {% if var.default_value_str | length > 100 -%} + + + {%- endif -%} + {{ var.default_value_str | escape | linkify }} + {%- endif -%} +{% enddefaultmacro %} +{% defaultmacro annotation(var) %} + {%- if var.annotation_str -%} + {{ var.annotation_str | escape | linkify }} + {%- endif -%} +{% enddefaultmacro %} +{% defaultmacro decorators(doc) %} + {% for d in doc.decorators if not d.startswith("@_") %} +
    {{ d }}
    + {% endfor %} +{% enddefaultmacro %} +{% defaultmacro function(fn) -%} + {{ decorators(fn) }} + {% if fn.name == "__init__" %} + {{ ".".join(fn.qualname.split(".")[:-1]) }} + {{- fn.signature_without_self | format_signature(colon=False) | linkify }} + {% else %} + {{ fn.funcdef }} + {{ fn.name }} + {{- fn.signature | format_signature(colon=True) | linkify }} + {% endif %} +{% enddefaultmacro %} +{% defaultmacro variable(var) -%} + {%- if var.is_type_alias_type %}type {% endif -%} + {{ var.name }}{{ annotation(var) }}{{ default_value(var) }} +{% enddefaultmacro %} +{% defaultmacro submodule(mod) -%} + {{ mod.taken_from | link }} +{% enddefaultmacro %} +{% defaultmacro class(cls) -%} + {{ decorators(cls) }} + class + {{ cls.qualname }} + {{- bases(cls) -}}: +{% enddefaultmacro %} +{% defaultmacro member(doc) %} + {{- view_source_state(doc) -}} +
    + {% if doc.kind == "class" %} + {{ class(doc) }} + {% elif doc.kind == "function" %} + {{ function(doc) }} + {% elif doc.kind == "module" %} + {{ submodule(doc) }} + {% else %} + {{ variable(doc) }} + {% endif %} + {{ view_source_button(doc) }} +
    + + {{ view_source_code(doc) }} + {{ docstring(doc) }} +{% enddefaultmacro %} +{% defaultmacro docstring(var) %} + {% if var.docstring %} +
    {{ var.docstring | replace("@public", "") | to_markdown | to_html | linkify(namespace=var.qualname) }}
    + {% endif %} +{% enddefaultmacro %} +{% defaultmacro nav_members(members) %} +
      + {% for m in members if is_public(m) | trim %} +
    • + {% if m.kind == "class" %} + {{ m.qualname }} + {% if m.own_members %} + {{ nav_members(m.own_members) | indent(12) }} + {% endif %} + {% elif m.kind == "module" %} + {{ m.name }} + {% elif m.name == "__init__" %} + {{ m.qualname.split(".")[-2] }} + {% else %} + {{ m.name }} + {% endif %} +
    • + {% endfor %} +
    +{% enddefaultmacro %} +{% defaultmacro is_public(doc) %} + {# + This macro is a bit unconventional in that its output is not rendered, but treated as a boolean: + Returning no text is interpreted as false, returning any other text is iterpreted as true. + Implementing this as a macro makes it very easy to override with a custom template, see + https://github.com/mitmproxy/pdoc/tree/main/examples/custom-template. + #} + {% if "@private" in doc.docstring %} + {# hide members explicitly marked as @private #} + {% elif "@public" in doc.docstring %} + {# show members explicitly marked as @public #} + true + {% elif not include_undocumented and not doc.docstring %} + {# hide members that are undocumented if include_undocumented has been toggled off. #} + {% elif doc.name == "__init__" and (doc.docstring or (doc.kind == "function" and doc.signature_without_self.parameters)) %} + {# show constructors that have a docstring or at least one extra argument #} + true + {% elif doc.name == "__doc__" %} + {# We don't want to document __doc__ itself, https://github.com/mitmproxy/pdoc/issues/235 #} + {% elif doc.kind == "variable" and doc.is_typevar and not doc.docstring %} + {# do not document TypeVars, that only clutters the docs. #} + {% elif doc.kind == "module" and doc.fullname not in all_modules %} + {# Skip modules that were manually excluded, https://github.com/mitmproxy/pdoc/issues/334 #} + {% elif (doc.qualname or doc.name) is in(module.obj.__all__ or []) %} + {# members starting with an underscore are still public if mentioned in __all__ #} + true + {% elif not doc.name.startswith("_") %} + {# members not starting with an underscore are considered public by default #} + true + {% endif %} +{% enddefaultmacro %} +{# fmt: off #} +{# fmt: on #} +{% defaultmacro view_source_state(doc) %} + {% if show_source and doc.source %} + + {% endif %} +{% enddefaultmacro %} +{% defaultmacro view_source_button(doc) %} + {% if show_source and doc.source %} + + {% endif %} +{% enddefaultmacro %} +{% defaultmacro view_source_code(doc) %} + {% if show_source and doc.source %} + {{ doc | highlight }} + {% endif %} +{% enddefaultmacro %} +{% defaultmacro module_name() %} +

    + {% set parts = module.modulename.split(".") %} + {% for part in parts %} + {%- set fullname = ".".join(parts[:loop.index]) -%} + {%- if fullname in all_modules and fullname != module.modulename -%} + {{ part }} + {%- else -%} + {{ part }} + {%- endif -%} + {%- if loop.nextitem -%} + . + {%- endif -%} + {% endfor %} +

    +{% enddefaultmacro %} From cc2f646733abd46ff4996e31eefe493d2b651fbd Mon Sep 17 00:00:00 2001 From: Roi Bar-Holem Date: Tue, 7 May 2024 17:31:26 +0300 Subject: [PATCH 07/11] Create error.html.jinja2 --- pdoc/template/error.html.jinja2 | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 pdoc/template/error.html.jinja2 diff --git a/pdoc/template/error.html.jinja2 b/pdoc/template/error.html.jinja2 new file mode 100644 index 0000000..6ffdb5d --- /dev/null +++ b/pdoc/template/error.html.jinja2 @@ -0,0 +1,38 @@ +{# this template is used by pdoc's integrated web server to display runtime errors. #} +{% extends "frame.html.jinja2" %} +{% block title %}{{ error }}{% endblock %} +{% block style %} + + +{% endblock %} +{% block body %} +

    {{ error }}

    +
    {{ details }}
    +
    + +{% endblock %} From a6e2bef9c329f498cdec87d579612ceb83b7dd27 Mon Sep 17 00:00:00 2001 From: Roi Bar-Holem Date: Tue, 7 May 2024 17:33:40 +0300 Subject: [PATCH 08/11] Create index.html.jinja2 --- pdoc/template/index.html.jinja2 | 74 +++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 pdoc/template/index.html.jinja2 diff --git a/pdoc/template/index.html.jinja2 b/pdoc/template/index.html.jinja2 new file mode 100644 index 0000000..6653876 --- /dev/null +++ b/pdoc/template/index.html.jinja2 @@ -0,0 +1,74 @@ +{# this template is used to render the top-level index.html. #} +{% if root_module_name %} +{# +If there is one common parent module for all documented modules, redirect there immediately. +This makes a package's `__init__.py` the main entrypoint by default. +A custom template could override this by setting root_module_name to false before `{% extend ... %}`. +#} + + + + + + + +{% else %} +{% extends "frame.html.jinja2" %} +{% block title %}Module List – pdoc {{ __version__ }}{% endblock %} +{% block style %} + {{ super() | safe }} + +{% endblock %} +{% block nav %} +

    Available Modules

    +
      + {% for submodule in all_modules if "._" not in submodule and not submodule.startswith("_") %} +
    • {{ submodule }}
    • + {% endfor %} +
    +{% endblock %} +{% block content %} +
    + {% block logo %} + {% if logo %} + {% if logo_link %}{% endif %} + project logo + {% if logo_link %}{% endif %} + {% else %} + + pdoc + + {% endif %} + {% endblock %} + {% if search %} + + {% endif %} +
    +
    + {% if search %} + {% include "search.html.jinja2" %} + {% endif %} +{% endblock %} +{% endif %} From 56c1fdc7360eefbd71f4885d37c1d2fd66a001eb Mon Sep 17 00:00:00 2001 From: Roi Bar-Holem Date: Tue, 7 May 2024 17:34:26 +0300 Subject: [PATCH 09/11] Create frame.html.jinja --- pdoc/template/frame.html.jinja | 45 ++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 pdoc/template/frame.html.jinja diff --git a/pdoc/template/frame.html.jinja b/pdoc/template/frame.html.jinja new file mode 100644 index 0000000..a965fc5 --- /dev/null +++ b/pdoc/template/frame.html.jinja @@ -0,0 +1,45 @@ + + + + + + + {% block title %}{% endblock %} + {% block favicon %} + {% if favicon %} + + {% endif %} + {% endblock %} + {% block head %}{% endblock %} + {% filter minify_css | indent %} + {% block style %} + + + {# + The style_pdoc, style_theme, style_layout, and style_content Jinja2 blocks are deprecated and will be + removed in a future release. Custom templates should either provide alternatives for the specific CSS files, + or append their own styles by providing `custom.css` (see examples/custom-template/). + #} + {% block style_pdoc %} + {% block style_theme %}{% endblock %} + {% block style_layout %}{% endblock %} + {% block style_content %}{% endblock %} + {# Use this file in your custom template directory to add additional CSS styling: #} + + {% endblock %} + {% endblock %} + {% endfilter %} + {% if math %}{% include "math.html.jinja2" %}{% endif %} + {% if mermaid %}{% include "mermaid.html.jinja2" %}{% endif %} + + +{% block body %} + + {% block content %}{% endblock %} +{% endblock body %} + + From 2809b5067fc389fd3ba98a784a528f01cb66787c Mon Sep 17 00:00:00 2001 From: Roi Bar-Holem Date: Tue, 7 May 2024 18:02:29 +0300 Subject: [PATCH 10/11] remove inherited --- generate_docs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate_docs.sh b/generate_docs.sh index 38148cc..384cb67 100755 --- a/generate_docs.sh +++ b/generate_docs.sh @@ -29,7 +29,7 @@ fi echo Generating docs cd $ROOT -pdoc --docformat google -o $DOCS_DIR ./sony_custom_layers/{keras,pytorch} --no-include-undocumented --no-search +pdoc --docformat google -o $DOCS_DIR ./sony_custom_layers/{keras,pytorch} --no-include-undocumented --no-search -t ./pdoc/template if [ "$ENV_DIR" ];then echo Removing $ENV_DIR From ded4136e1e8d19297f80bdf6bf6cf6a5c176d55a Mon Sep 17 00:00:00 2001 From: "GitHub Actions [Bot]" Date: Tue, 7 May 2024 15:04:10 +0000 Subject: [PATCH 11/11] Update docs [Created by Github action] --- docs/sony_custom_layers/keras.html | 194 --------------------------- docs/sony_custom_layers/pytorch.html | 10 -- 2 files changed, 204 deletions(-) diff --git a/docs/sony_custom_layers/keras.html b/docs/sony_custom_layers/keras.html index d48a6c1..f910983 100644 --- a/docs/sony_custom_layers/keras.html +++ b/docs/sony_custom_layers/keras.html @@ -239,73 +239,6 @@
    Example:
-
-
Inherited Members
-
-
sony_custom_layers.keras.base_custom_layer.CustomLayer
-
from_config
- -
-
keras.src.engine.base_layer.Layer
-
build
-
add_weight
-
compute_output_shape
-
compute_output_signature
-
compute_mask
-
dtype
-
name
-
supports_masking
-
dynamic
-
trainable
-
activity_regularizer
-
input_spec
-
trainable_weights
-
non_trainable_weights
-
weights
-
losses
-
add_loss
-
metrics
-
add_metric
-
add_update
-
set_weights
-
get_weights
-
finalize_state
-
get_input_mask_at
-
get_output_mask_at
-
input_mask
-
output_mask
-
get_input_shape_at
-
get_output_shape_at
-
get_input_at
-
get_output_at
-
input
-
output
-
input_shape
-
count_params
-
output_shape
-
dtype_policy
-
compute_dtype
-
variable_dtype
-
inbound_nodes
-
outbound_nodes
-
variables
-
trainable_variables
-
non_trainable_variables
-
add_variable
-
get_build_config
-
build_from_config
-
save_own_variables
-
load_own_variables
- -
-
tensorflow.python.module.module.Module
-
name_scope
-
submodules
-
with_name_scope
- -
-
-
@@ -330,66 +263,6 @@
Inherited Members
-
-
Inherited Members
-
-
enum.Enum
-
name
-
value
- -
-
builtins.str
-
encode
-
replace
-
split
-
rsplit
-
join
-
capitalize
-
casefold
-
title
-
center
-
count
-
expandtabs
-
find
-
partition
-
index
-
ljust
-
lower
-
lstrip
-
rfind
-
rindex
-
rjust
-
rstrip
-
rpartition
-
splitlines
-
strip
-
swapcase
-
translate
-
upper
-
startswith
-
endswith
-
removeprefix
-
removesuffix
-
isascii
-
islower
-
isupper
-
istitle
-
isspace
-
isdecimal
-
isdigit
-
isnumeric
-
isalpha
-
isalnum
-
isidentifier
-
isprintable
-
zfill
-
format
-
format_map
-
maketrans
- -
-
-
@@ -602,73 +475,6 @@
Example:
-
-
Inherited Members
-
-
sony_custom_layers.keras.base_custom_layer.CustomLayer
-
from_config
- -
-
keras.src.engine.base_layer.Layer
-
build
-
add_weight
-
compute_output_shape
-
compute_output_signature
-
compute_mask
-
dtype
-
name
-
supports_masking
-
dynamic
-
trainable
-
activity_regularizer
-
input_spec
-
trainable_weights
-
non_trainable_weights
-
weights
-
losses
-
add_loss
-
metrics
-
add_metric
-
add_update
-
set_weights
-
get_weights
-
finalize_state
-
get_input_mask_at
-
get_output_mask_at
-
input_mask
-
output_mask
-
get_input_shape_at
-
get_output_shape_at
-
get_input_at
-
get_output_at
-
input
-
output
-
input_shape
-
count_params
-
output_shape
-
dtype_policy
-
compute_dtype
-
variable_dtype
-
inbound_nodes
-
outbound_nodes
-
variables
-
trainable_variables
-
non_trainable_variables
-
add_variable
-
get_build_config
-
build_from_config
-
save_own_variables
-
load_own_variables
- -
-
tensorflow.python.module.module.Module
-
name_scope
-
submodules
-
with_name_scope
- -
-
-
diff --git a/docs/sony_custom_layers/pytorch.html b/docs/sony_custom_layers/pytorch.html index f92193a..558d970 100644 --- a/docs/sony_custom_layers/pytorch.html +++ b/docs/sony_custom_layers/pytorch.html @@ -458,16 +458,6 @@
Example:
-
-
Inherited Members
-
-
builtins.tuple
-
index
-
count
- -
-
-