Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support setting linewidth when printing tensor #35175

Merged
merged 7 commits into from
Sep 1, 2021

Conversation

zhiqiu
Copy link
Contributor

@zhiqiu zhiqiu commented Aug 26, 2021

PR types

New features

PR changes

APIs

Describe

support setting linewith when printing tensor

example:

import paddle
paddle.set_device('cpu')
print(paddle.rand([128]))
  • before
Tensor(shape=[128], dtype=float32, place=CPUPlace, stop_gradient=True,
       [0.25879696, 0.50074619, 0.42323840, 0.82446575, 0.39084101, 0.92338073, 0.19577874, 0.24568094, 0.27637541, 0.60177094, 0.86259216, 0.61054200, 0.33126462, 0.93450648, 0.00483538, 0.99225968, 0.12046290, 0.74805290, 0.98294413, 0.70920837, 0.19146118, 0.07873910, 0.55049354, 0.42201182, 0.59506327, 0.68768454, 0.51395941, 0.32184485, 0.62919736, 0.08746319, 0.85324347, 0.63044840, 0.95606005, 0.88146579, 0.36332738, 0.96352220, 0.51063681, 0.04236199, 0.15389654, 0.30684447, 0.42809242, 0.67423820, 0.97434431, 0.99616867, 0.33430573, 0.10935546, 0.42269734, 0.05253475, 0.17454797, 0.38270098, 0.11430093, 0.26122841, 0.19456232, 0.65461051, 0.56123203, 0.49002135, 0.31312251, 0.93153483, 0.30818963, 0.15251365, 0.32353821, 0.30551898, 0.36442485, 0.40510795, 0.89311606, 0.92002070, 0.68200099, 0.40158343, 0.50882781, 0.30949739, 0.12179364, 0.39190039, 0.79011095, 0.54286033, 0.04059581, 0.83654737, 0.65178066, 0.11252493, 0.76168078, 0.88825911, 0.94004720, 0.05871697, 0.71592027, 0.61785829, 0.09553445, 0.91939163, 0.70225674, 0.28409877, 0.81965858, 0.80185008, 0.97601324, 0.93515635, 0.22272588, 0.65675360, 0.98064482, 0.74841386, 0.96231246, 0.02801217, 0.12536934, 0.36017764, 0.27299404, 0.49377578, 0.50777233, 0.30256188, 0.60731179, 0.29038930, 0.09265211, 0.34631616, 0.30070779, 0.52958041, 0.87109202, 0.60556680, 0.38582516, 0.18227829, 0.06854590, 0.52260894, 0.79142720, 0.76220429, 0.22608277, 0.75814641, 0.92421502, 0.11488840, 0.94726086, 0.40558460, 0.29326001, 0.92102498, 0.89815515, 0.24918547])
  • after
Tensor(shape=[128], dtype=float32, place=CPUPlace, stop_gradient=True,
       [0.64210677, 0.29518706, 0.02316176, 0.92657983, 0.86357725, 0.34900561,
        0.83634359, 0.02825335, 0.70678812, 0.88396561, 0.84726501, 0.02937236,
        0.32962683, 0.14127953, 0.39749566, 0.39639288, 0.68818319, 0.85836589,
        0.29287007, 0.39107677, 0.66112262, 0.54898244, 0.08978599, 0.52089310,
        0.39118996, 0.96775877, 0.42206866, 0.54190171, 0.47031319, 0.51122624,
        0.73364568, 0.23708570, 0.15532853, 0.73647565, 0.22350034, 0.10148101,
        0.80225837, 0.76297283, 0.60741764, 0.73123831, 0.21276061, 0.42741513,
        0.59695411, 0.45203823, 0.19846323, 0.50947398, 0.83071703, 0.28732094,
        0.34440970, 0.11087228, 0.00979803, 0.49785492, 0.52611905, 0.81910795,
        0.72262925, 0.09054404, 0.62422019, 0.01256844, 0.25523758, 0.18106040,
        0.50645089, 0.30861688, 0.33442861, 0.77534479, 0.45010498, 0.16513087,
        0.32983506, 0.56820840, 0.24458770, 0.85438418, 0.41875023, 0.14537217,
        0.89864367, 0.77489346, 0.00518836, 0.89297730, 0.89268827, 0.79128748,
        0.53369522, 0.57141852, 0.09816289, 0.30599827, 0.69243705, 0.97171158,
        0.04167920, 0.11852661, 0.01744425, 0.28972524, 0.02576177, 0.41406485,
        0.82753962, 0.30737782, 0.57591951, 0.82203513, 0.70567185, 0.92207402,
        0.96810609, 0.38387364, 0.24886288, 0.11878176, 0.70832491, 0.64576322,
        0.50040072, 0.13337536, 0.01327138, 0.24596225, 0.78893894, 0.06154043,
        0.36811954, 0.39499450, 0.87873530, 0.05128795, 0.82705784, 0.50951785,
        0.23817837, 0.07571696, 0.49847323, 0.14726780, 0.36729920, 0.07978059,
        0.20751251, 0.09077857, 0.34751672, 0.04037165, 0.01764036, 0.12095008,
        0.76149827, 0.07044062])

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@zhiqiu zhiqiu changed the title support setting linewith when printing tensor support setting linewidth when printing tensor Aug 27, 2021
@zhiqiu zhiqiu requested a review from phlrain August 30, 2021 06:35
lanxianghit
lanxianghit previously approved these changes Aug 31, 2021
Copy link
Contributor

@lanxianghit lanxianghit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zhiqiu zhiqiu merged commit 5fa7d9c into PaddlePaddle:develop Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants