Skip to content

SymmetryLossWarning stack trace should point to user call location #61

@wilswu99

Description

@wilswu99

Currently, SymmetryLossWarning points to whest/_ndarray.py, which makes debugging difficult. It should point to the user call site instead.

Example:

import whest as we
sg = we.SymmetryGroup
 
with we.BudgetContext(flop_budget=1e20) as bc:
    n = 10
    with we.namespace('init'):
        A = we.random.randn(n, n, n)
        B = we.random.randn(n, n, n)
        # A = we.symmetrize(A, symmetry=sg.cyclic(axes=(0, 1, 2)))
        A = we.symmetrize(A, symmetry=sg.symmetric(axes=(0, 1)))
        B = we.symmetrize(B, symmetry=sg.cyclic(axes=(0, 1, 2)))
    with we.namespace('sum'):
        X = A + B

gives

whest/src/whest/_ndarray.py:83: SymmetryLossWarning: Symmetry lost along dims (0, 1), (0, 1, 2): add — no symmetry groups shared by both operands. Use as_symmetric() to re-tag if you know the result is symmetric. Suppress with we.configure(symmetry_warnings=False).
  return _me().add(self, other)

which is uninformative.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:p2Nice-to-have, scheduledtopic:symmetrySymmetry metadata, inference, propagation, groups, and symmetric tensors

    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