Git Product home page Git Product logo

Comments (6)

tonyfast avatar tonyfast commented on May 18, 2024 1

Here is a sample view:

image

from metadsl.

pearu avatar pearu commented on May 18, 2024

Perhaps offtopic: while looking at the repr tree of an expression is useful, it disturbs the mathematical interpretation by a human. Would it make sense to invent a less verbose representation of such a tree, for instance:

BOp
  A(shape=None)[1][0][2]
  *
  InnerProduct
    A(shape=A_shape[2])
    ...

or similar in terms of verbosity?

from metadsl.

saulshanabrook avatar saulshanabrook commented on May 18, 2024

@pearu Yes that is a good idea. The __str__ version does this partially, but it doesn't do any indenting. It might be nice to have a __str__ pprint version as well as a __repr__ pprint version

from metadsl.

saulshanabrook avatar saulshanabrook commented on May 18, 2024

I have this kind of pretty printing now working in jupyter notebooks: https://github.com/Quansight-Labs/uarray/blob/master/uarray/uarray/printing.py

from metadsl.

tonyfast avatar tonyfast commented on May 18, 2024

You may prefer the IPython machinery for registering your reprs.

    def load_ipython_extension(ip):
        ip.display_formatter.formatters['text/plain'].for_type(matchpy.Operation, repr_pretty)

This would avoid some hard coding the reprs.

More info @ https://ipython.readthedocs.io/en/stable/api/generated/IPython.display.html#IPython.display.display

from metadsl.

saulshanabrook avatar saulshanabrook commented on May 18, 2024

Ah nice thanks for that code snippet. Reopening this to adopt that

from metadsl.

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.