{"library":"lovely-tensors","title":"Lovely Tensors","description":"lovely-tensors is a Python library that provides \"syntax sugar\" for PyTorch tensors, enhancing their default `repr` for better readability, debugging, and development. It adds features like rich, colored, and pretty-printed output, automatic batching, and shape inference. As of version 0.1.22, it is actively maintained with frequent minor releases focusing on new features and improvements.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install lovely-tensors"],"cli":null},"imports":["import lovely_tensors as lt","import lovely_tensors as lt\nlt.monkey_patch()","import lovely_tensors as lt\nlt.lovely(my_tensor)"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import torch\nimport lovely_tensors as lt\n\n# Enable beautiful tensor repr globally\nlt.monkey_patch()\n\n# Create some tensors\na = torch.randn(2, 3, 4)\nb = torch.randint(0, 10, (1, 5), dtype=torch.int)\n\nprint(f\"Tensor a:\\n{a}\")\nprint(f\"Tensor b:\\n{b}\")\n\n# You can also explicitly print lovely tensors without monkey-patching\n# For demonstration, let's pretend monkey_patch wasn't called:\n# import lovely_tensors as lt\n# lt.lovely(torch.tensor([1,2,3]))","lang":"python","description":"This quickstart demonstrates how to import `lovely-tensors`, enable its global monkey-patching for `torch.Tensor`'s `__repr__`, and then print PyTorch tensors to see the enhanced, colored output. It also shows how to use `lt.lovely()` for explicit pretty-printing.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}