Skip to content

How to support model$getParam(nodes[i], 'mean') #15

@perrydv

Description

@perrydv

Here is a question from starting work on model$getParam. In nimble a while back we encountered the need to use getParam for any element from a vector of nodes, so we built support for model$getParam(nodes[i], 'mean'), where nodes is a setup output and nodes[i] at run-time uses the i-th node. This allowed an algorithm to iterate over a vector of nodes, using the same parameter for each. IIRC in compilation we essentially use model$getParam(nodes, i, 'mean'), i.e. we rearrange so that the index is an argument we manage, and we create a nodeFxnVector for all of nodes, which allows in C++ to pick out the i-th one dynamically. Also note that for this purpose, nodes could be ordered arbitrarily and there is no need for topological sorting, and moreover the ordering of nodes shouldn't be changed in any way the user doesn't realize, because they may have logic to how it is ordered in relation to how they are ordering related data structures. This all suggests we need to support arbitrary ordering even when it is somewhat unnatural with the new node abstractions. I would imagine often a user's (or algorithm's) ordering will be "natural" and that will match our compact representations (e.g. x[1:10000]), but we need to support anything. Does this make sense @paciorek?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions