Giter Site home page Giter Site logo

Comments (6)

Joao-L-S-Almeida avatar Joao-L-S-Almeida commented on August 28, 2024 1

Give a look, @TarikKaanKoc, in the commit ef2bc63 of the branch fix/pytorch-residuals-module, apparently it is a solution.
In addition to the preference for PyTorch, I think the factory function which was being used was not the best solution, since we cannot guarantee the entire source code can be reused with different backends as JAX and Apache MXNet, just changing the importing source.

from simulai.

Joao-L-S-Almeida avatar Joao-L-S-Almeida commented on August 28, 2024

Hi. Let me know if I understand properly. Have you flawlessly build the docs locally, but it is not being updated in RTD ?

from simulai.

TarikKaanKoc avatar TarikKaanKoc commented on August 28, 2024

Hi. Let me know if I understand properly. Have you flawlessly build the docs locally, but it is not being updated in RTD ?

Hi, I will check now. I'm sorry I wasn't available because of the earthquake.

from simulai.

TarikKaanKoc avatar TarikKaanKoc commented on August 28, 2024

Difficulty documenting class within function

When attempting to generate documentation with Sphinx, I am having trouble documenting a class that is defined within a function. The current setup is as follows:

def SymbolicOperator(
    expressions: list = None,
    input_vars: list = None,
    output_vars: list = None,
    function: callable = None,
    gradient: callable = None,
    keys: str = None,
    inputs_key: str = None,
    processing: str = "serial",
    device: str = "cpu",
    engine: str = "torch",
    auxiliary_expressions: list = None,
    constants: dict = None,
) -> object:
    """
    Constructs a tensor operator using symbolic expressions using PyTorch or any other supported engine.

    Args:
        expressions (list, optional): List of expressions representing the operator. Defaults to None.
        input_vars (list, optional): List of input variables. Defaults to None.
        output_vars (list, optional): List of output variables. Defaults to None.
        function (callable, optional): A callable that represents the evaluation of the tensor operator. Defaults to None.
        gradient (callable, optional): A callable that represents the gradient evaluation of the tensor operator. Defaults to None.
        keys (str, optional): The keys for accessing the inputs in the input dictionary. Defaults to None.
        inputs_key (str, optional): The key for accessing the input data in the input dictionary. Defaults to None.
        processing (str, optional): The processing method to be used during the evaluation of the tensor operator. Defaults to 'serial'.
        device (str, optional): The device to be used during the evaluation of the tensor operator. Can be either 'cpu' or 'gpu'. Defaults to 'cpu'.
        engine (str, optional): The symbolic computation engine to be used. Currently supported engines are 'torch' and 'numpy'. Defaults to 'torch'.
        auxiliary_expressions (list, optional): Additional expressions that are needed to evaluate the tensor operator. Defaults to None.
        constants (dict, optional): Constants that are required during the evaluation of the tensor operator. Defaults to None.

    Returns:
        object: An instance of the SymbolicOperatorClass.
    """

    class SymbolicOperatorClass(torch.nn.Module if engine == "torch" else object):

Difficulty documenting a class defined within a function

I am having trouble documenting a class that is defined within a function when generating documentation with Sphinx. To properly document a class with Sphinx, it should be defined outside the function and then its documentation should be written in a separate documentation block. This way, Sphinx can generate separate documentation for both the function and the class.

@Joao-L-S-Almeida

from simulai.

TarikKaanKoc avatar TarikKaanKoc commented on August 28, 2024

How about we fix this or leave it as it is? @Joao-L-S-Almeida

from simulai.

Joao-L-S-Almeida avatar Joao-L-S-Almeida commented on August 28, 2024

Hi. @TarikKaanKoc. This implementation uses a factory function to return the class SymbolicOperator in order to support the usage of others backends than PyTorch. However, as we are currently more interested in using PyTorch as foundation (and, certainly, there are better ways to support multiple engines) I will make it a simple class in the branch associated with this issue.

from simulai.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.