Skip to content

xdoctest logs are unreadable #123166

@zou3519

Description

@zou3519

There's a lot of escape sequences:

2024-04-02T00:00:51.7265959Z         �[94m37�[39;49;00m >>>     �[90m# Number of nonzero-elements is data-dependent.�[39;49;00m�[90m�[39;49;00m
2024-04-02T00:00:51.7268115Z         �[94m38�[39;49;00m >>>     �[90m# Since we cannot peek at the data in an abstract impl,�[39;49;00m�[90m�[39;49;00m
2024-04-02T00:00:51.7270364Z         �[94m39�[39;49;00m >>>     �[90m# we use the ctx object to construct a new symint that�[39;49;00m�[90m�[39;49;00m
2024-04-02T00:00:51.7272460Z         �[94m40�[39;49;00m >>>     �[90m# represents the data-dependent size.�[39;49;00m�[90m�[39;49;00m
2024-04-02T00:00:51.7274047Z         �[94m41�[39;49;00m >>>     ctx = torch.library.get_ctx()�[90m�[39;49;00m
2024-04-02T00:00:51.7275429Z         �[94m42�[39;49;00m >>>     nnz = ctx.new_dynamic_size()�[90m�[39;49;00m
2024-04-02T00:00:51.7276755Z         �[94m43�[39;49;00m >>>     shape = [nnz, x.dim()]�[90m�[39;49;00m
2024-04-02T00:00:51.7278274Z         �[94m44�[39;49;00m >>>     result = x.new_empty(shape, dtype=torch.int64)�[90m�[39;49;00m
2024-04-02T00:00:51.7279895Z         �[94m45�[39;49;00m >>>     �[94mreturn�[39;49;00m result�[90m�[39;49;00m
2024-04-02T00:00:51.7281000Z         �[94m46�[39;49;00m >>>�[90m�[39;49;00m
2024-04-02T00:00:51.7282875Z         �[94m47�[39;49;00m >>> x = torch.tensor([�[94m0�[39;49;00m, �[94m1�[39;49;00m, �[94m2�[39;49;00m, �[94m0�[39;49;00m, �[94m0�[39;49;00m, �[94m1�[39;49;00m])
2024-04-02T00:00:51.7285126Z         �[94m48�[39;49;00m >>> �[90m# xdoctest: +SKIP("Requires Python <= 3.11")�[39;49;00m�[90m�[39;49;00m
2024-04-02T00:00:51.7286695Z         �[94m49�[39;49;00m >>> out = torch.compile(custom_nonzero)(x)
2024-04-02T00:00:51.7288446Z         �[94m50�[39;49;00m >>> �[90m# xdoctest: +SKIP("Requires Python <= 3.11")�[39;49;00m�[90m�[39;49;00m
2024-04-02T00:00:51.7290141Z         �[94m51�[39;49;00m >>> �[94massert�[39;49;00m torch.allclose(out, x.nonzero())
2024-04-02T00:00:51.7291340Z     �[01mDOCTEST TRACEBACK�[39;49;00m
2024-04-02T00:00:51.7292126Z     Traceback (most recent call last):
2024-04-02T00:00:51.7292900Z     �[90m�[39;49;00m
2024-04-02T00:00:51.7294923Z       File �[96m"/opt/conda/envs/py_3.11/lib/python3.11/site-packages/xdoctest/doctest_example.py"�[39;49;00m, line �[94m811�[39;49;00m, in run�[90m�[39;49;00m
2024-04-02T00:00:51.7297131Z     �[90m    �[39;49;00mexec(code, test_globals)�[90m�[39;49;00m
2024-04-02T00:00:51.7298080Z     �[90m�[39;49;00m
2024-04-02T00:00:51.7300403Z       File "<doctest:/opt/conda/envs/py_3.11/lib/python3.11/site-packages/torch/_library/custom_ops.py::CustomOpDef.register_fake:0>", line rel: 6, abs: 229, in <module>
2024-04-02T00:00:51.7302885Z         >>> @torch.library.custom_op("mylib::custom_linear", mutated_args=())
2024-04-02T00:00:51.7304004Z     �[90m�[39;49;00m
2024-04-02T00:00:51.7305989Z       File �[96m"/opt/conda/envs/py_3.11/lib/python3.11/site-packages/torch/_library/custom_ops.py"�[39;49;00m, line �[94m76�[39;49;00m, in inner�[90m�[39;49;00m
2024-04-02T00:00:51.7308546Z     �[90m    �[39;49;00mresult = CustomOpDef(namespace, opname, schema, fn)�[90m�[39;49;00m
2024-04-02T00:00:51.7310062Z     �[90m             �[39;49;00m^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^�[90m�[39;49;00m
2024-04-02T00:00:51.7311064Z     �[90m�[39;49;00m
2024-04-02T00:00:51.7313102Z       File �[96m"/opt/conda/envs/py_3.11/lib/python3.11/site-packages/torch/_library/custom_ops.py"�[39;49;00m, line �[94m106�[39;49;00m, in __init__�[90m�[39;49;00m
2024-04-02T00:00:51.7315552Z     �[90m    �[39;49;00m�[96mself�[39;49;00m._register_to_dispatcher()�[90m�[39;49;00m
2024-04-02T00:00:51.7316688Z     �[90m�[39;49;00m
2024-04-02T00:00:51.7318883Z       File �[96m"/opt/conda/envs/py_3.11/lib/python3.11/site-packages/torch/_library/custom_ops.py"�[39;49;00m, line �[94m282�[39;49;00m, in _register_to_dispatcher�[90m�[39;49;00m
2024-04-02T00:00:51.7322956Z     �[90m    �[39;49;00mlib.define(�[33mf�[39;49;00m�[33m"�[39;49;00m�[33m{�[39;49;00m�[96mself�[39;49;00m._name�[33m}�[39;49;00m�[33m{�[39;49;00m�[96mself�[39;49;00m._schema�[33m}�[39;49;00m�[33m"�[39;49;00m)�[90m�[39;49;00m
2024-04-02T00:00:51.7325154Z     �[90m�[39;49;00m
2024-04-02T00:00:51.7327053Z       File �[96m"/opt/conda/envs/py_3.11/lib/python3.11/site-packages/torch/library.py"�[39;49;00m, line �[94m110�[39;49;00m, in define�[90m�[39;49;00m
2024-04-02T00:00:51.7329975Z     �[90m    �[39;49;00mresult = �[96mself�[39;49;00m.m.define(schema, alias_analysis, �[96mtuple�[39;49;00m(tags))�[90m�[39;49;00m
2024-04-02T00:00:51.7331967Z     �[90m             �[39;49;00m^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^�[90m�[39;49;00m
2024-04-02T00:00:51.7333046Z     �[90m�[39;49;00m
2024-04-02T00:00:51.7399660Z     �[04m�[91mR�[39;49;00m�[04m�[91mu�[39;49;00m�[04m�[91mn�[39;49;00m�[04m�[91mt�[39;49;00m�[04m�[91mi�[39;49;00m�[04m�[91mm�[39;49;00m�[04m�[91me�[39;49;00m�[04m�[91mE�[39;49;00m�[04m�[91mr�[39;49;00m�[04m�[91mr�[39;49;00m�[04m�[91mo�[39;49;00m�[04m�[91mr�[39;49;00m�[04m�[91m:�[39;49;00m�[04m�[91m �[39;49;00m�[04m�[91mT�[39;49;00m�[04m�[91mr�[39;49;00m�[04m�[91mi�[39;49;00m�[04m�[91me�[39;49;00m�[04m�[91md�[39;49;00m�[04m�[91m �[39;49;00m�[04m�[91mt�[39;49;00m�[04m�[91mo�[39;49;00m�[04m�[91m �[39;49;00m�[04m�[91mr�[39;49;00m�[04m�[91me�[39;49;00m�[04m�[91mg�[39;49;00m�[04m�[91mi�[39;49;00m�[04m�[91ms�[39;49;00m�[04m�[91mt�[39;49;00m�[04m�[91me�[39;49;00m�[04m�[91mr�[39;49;00m�[04m�[91m �[39;49;00m�[04m�[91ma�[39;49;00m�[04m�[91mn�[39;49;00m�[04m�[91m �[39;49;00m�[04m�[91mo�[39;49;00m�[04m�[91mp�[39;49;00m�[04m�[91me�[39;49;00m�[04m�[91mr�[39;49;00m�[04m�[91ma�[39;49;00m�[04m�[91mt�[39;49;00m�[04m�[91mo�[39;49;00m�[04m�[91mr�[39;49;00m�[04m�[91m �[39;49;00m�[04m�[91m(�[39;49;00m�[04m�[91mm�[39;49;00m�[04m�[91my�[39;49;00m�[04m�[91ml�[39;49;00m�[04m�[91mi�[39;49;00m�[04m�[91mb�[39;49;00m�[04m�[91m:�[39;49;00m�[04m�[91m:�[39;49;00m�[04m�[91mc�[39;49;00m�[04m�[91mu�[39;49;00m�[04m�[91ms�[39;49;00m�[04m�[91mt�[39;49;00m�[04m�[91mo�[39;49;00m�[04m�[91mm�[39;49;00m�[04m�[91m_�[39;49;00m�[04m�[91ml�[39;49;00m�[04m�[91mi�[39;49;00m�[04m�[91mn�[39;49;00m�[04m�[91me�[39;49;00m�[04m�[91ma�[39;49;00m�[04m�[91mr�[39;49;00m�[04m�[91m(�[39;49;00m�[04m�[91mT�[39;49;00m�[04m�[91me�[39;49;00m�[04m�[91mn�[39;49;00m�[04m�[91ms�[39;49;00m�[04m�[91mo�[39;49;00m�[04m�[91mr�[39;49;00m�[04m�[91m �[39;49;00m�[04m�[91mx�[39;49;00m�[04m�[91m,�[39;49;00m�[04m�[91m �[39;49;00m�[04m�[91mT�[39;49;00m�[04m�[91me�[39;49;00m�[04m�[91mn�[39;49;00m�[04m�[91ms�[39;49;00m�[04m�[91mo�[39;49;00m�[04m�[91mr�[39;49;00m�[04m�[91m 

cc @svekars @brycebortree @seemethere @malfet @pytorch/pytorch-dev-infra @mruberry @ZainRizvi

Metadata

Metadata

Assignees

Labels

module: ciRelated to continuous integrationmodule: docsRelated to our documentation, both in docs/ and docblocksmodule: testsIssues related to tests (not the torch.testing module)triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions