Skip to content

Option to place arrows below w.r.t atop in diagram #124

Open
@jerinphilip

Description

The connect_ family of functions do diagram + arrow as opposed to arrow + diagram.

return dia + arrow_between(ps, pe, style)

return dia + arrow_between(ps, pe, style)

return dia + arrow_between(ps, pe, style)

Since atop or + is not commutative, these have different output renderings and I've found a few use-cases for the latter. I think both are useful, and this is a feature request for specifying arrow + diagram or diagram + arrow through a switch.

To motivate the use-case with an example, left below is a reproduction of MultiHeadAttention from the original paper (right).

One process declaratively specifying this diagram involves stacking ScaledDotProductAttention (SDPA) for each head and the having Split branch out to each heads. connect_outside works for me here, but since I'm doing the connect after the stack is created - the arrows appear above, not honoring the depth dimension.

I have found some success for a custom Trail based arrow - see arrow_outside_up_free and arrow_outside_up.

PS: I don't mean to pile on the issues here, I'm happy to help and bring in a PR myself following consensus with some guidance. Also if there are alternative recommended routes with existing primitives that solves the above problem - open to trying those as well. Thanks for building and maintaining the library!

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions