Python 学习一 赋值问题

rdm=RandomState(1)
dataset_size=128
X=rdm.rand(dataset_size,2)
Y = [[int(x1+x2<1)] for (x1,x2)in X]

Y = [[int(x1+x2<1)] for (x1,x2)in X]

[[4.17022005e-01 7.20324493e-01]
 [1.14374817e-04 3.02332573e-01]
 [1.46755891e-01 9.23385948e-02]
 [1.86260211e-01 3.45560727e-01]
 [3.96767474e-01 5.38816734e-01]
 [4.19194514e-01 6.85219500e-01]
 [2.04452250e-01 8.78117436e-01]
 [2.73875932e-02 6.70467510e-01]
 [4.17304802e-01 5.58689828e-01]
 [1.40386939e-01 1.98101489e-01]
 [8.00744569e-01 9.68261576e-01]
 [3.13424178e-01 6.92322616e-01]
 [8.76389152e-01 8.94606664e-01]
 [8.50442114e-02 3.90547832e-02]
 [1.69830420e-01 8.78142503e-01]
 [9.83468338e-02 4.21107625e-01]
 [9.57889530e-01 5.33165285e-01]
 [6.91877114e-01 3.15515631e-01]
 [6.86500928e-01 8.34625672e-01]
 [1.82882773e-02 7.50144315e-01]
 [9.88861089e-01 7.48165654e-01]
 [2.80443992e-01 7.89279328e-01]
 [1.03226007e-01 4.47893526e-01]
 [9.08595503e-01 2.93614148e-01]
 [2.87775339e-01 1.30028572e-01]
 [1.93669579e-02 6.78835533e-01]
 [2.11628116e-01 2.65546659e-01]
 [4.91573159e-01 5.33625451e-02]
 [5.74117605e-01 1.46728575e-01]
 [5.89305537e-01 6.99758360e-01]
 [1.02334429e-01 4.14055988e-01]
 [6.94400158e-01 4.14179270e-01]
 [4.99534589e-02 5.35896406e-01]
 [6.63794645e-01 5.14889112e-01]
 [9.44594756e-01 5.86555041e-01]
 [9.03401915e-01 1.37474704e-01]
 [1.39276347e-01 8.07391289e-01]
 [3.97676837e-01 1.65354197e-01]
 [9.27508580e-01 3.47765860e-01]
 [7.50812103e-01 7.25997985e-01]
 [8.83306091e-01 6.23672207e-01]
 [7.50942434e-01 3.48898342e-01]
 [2.69927892e-01 8.95886218e-01]
 [4.28091190e-01 9.64840047e-01]
 [6.63441498e-01 6.21695720e-01]
 [1.14745973e-01 9.49489259e-01]
 [4.49912133e-01 5.78389614e-01]
 [4.08136803e-01 2.37026980e-01]
 [9.03379521e-01 5.73679487e-01]
 [2.87032703e-03 6.17144914e-01]
 [3.26644902e-01 5.27058102e-01]
 [8.85942099e-01 3.57269760e-01]
 [9.08535151e-01 6.23360116e-01]
 [1.58212428e-02 9.29437234e-01]
 [6.90896918e-01 9.97322850e-01]
 [1.72340508e-01 1.37135750e-01]
 [9.32595463e-01 6.96818161e-01]
 [6.60001727e-02 7.55463053e-01]
 [7.53876188e-01 9.23024536e-01]
 [7.11524759e-01 1.24270962e-01]
 [1.98801338e-02 2.62109869e-02]
 [2.83064880e-02 2.46211068e-01]
 [8.60027949e-01 5.38831064e-01]
 [5.52821979e-01 8.42030892e-01]
 [1.24173315e-01 2.79183679e-01]
 [5.85759271e-01 9.69595748e-01]
 [5.61030219e-01 1.86472894e-02]
 [8.00632673e-01 2.32974274e-01]
 [8.07105196e-01 3.87860644e-01]
 [8.63541855e-01 7.47121643e-01]
 [5.56240234e-01 1.36455226e-01]
 [5.99176895e-02 1.21343456e-01]
 [4.45518785e-02 1.07494129e-01]
 [2.25709339e-01 7.12988980e-01]
 [5.59716982e-01 1.25559802e-02]
 [7.19742797e-02 9.67276330e-01]
 [5.68100462e-01 2.03293235e-01]
 [2.52325745e-01 7.43825854e-01]
 [1.95429481e-01 5.81358927e-01]
 [9.70019989e-01 8.46828801e-01]
 [2.39847759e-01 4.93769714e-01]
 [6.19955718e-01 8.28980900e-01]
 [1.56791395e-01 1.85762022e-02]
 [7.00221437e-02 4.86345111e-01]
 [6.06329462e-01 5.68851437e-01]
 [3.17362409e-01 9.88616154e-01]
 [5.79745219e-01 3.80141173e-01]
 [5.50948219e-01 7.45334431e-01]
 [6.69232893e-01 2.64919558e-01]
 [6.63348344e-02 3.70084198e-01]
 [6.29717507e-01 2.10174010e-01]
 [7.52755554e-01 6.65364814e-02]
 [2.60315099e-01 8.04754564e-01]
 [1.93434283e-01 6.39460881e-01]
 [5.24670309e-01 9.24807970e-01]
 [2.63296770e-01 6.59610907e-02]
 [7.35065963e-01 7.72178030e-01]
 [9.07815853e-01 9.31972069e-01]
 [1.39515730e-02 2.34362086e-01]
 [6.16778357e-01 9.49016321e-01]
 [9.50176119e-01 5.56653188e-01]
 [9.15606350e-01 6.41566209e-01]
 [3.90007714e-01 4.85990667e-01]
 [6.04310483e-01 5.49547922e-01]
 [9.26181427e-01 9.18733436e-01]
 [3.94875613e-01 9.63262528e-01]
 [1.73955667e-01 1.26329519e-01]
 [1.35079158e-01 5.05662166e-01]
 [2.15248053e-02 9.47970211e-01]
 [8.27115471e-01 1.50189807e-02]
 [1.76196256e-01 3.32063574e-01]
 [1.30996845e-01 8.09490692e-01]
 [3.44736653e-01 9.40107482e-01]
 [5.82014180e-01 8.78831984e-01]
 [8.44734445e-01 9.05392319e-01]
 [4.59880266e-01 5.46346816e-01]
 [7.98603591e-01 2.85718852e-01]
 [4.90253523e-01 5.99110308e-01]
 [1.55332756e-02 5.93481408e-01]
 [4.33676349e-01 8.07360529e-01]
 [3.15244803e-01 8.92888709e-01]
 [5.77857215e-01 1.84010202e-01]
 [7.87929234e-01 6.12031177e-01]
 [5.39092721e-02 4.20193680e-01]
 [6.79068837e-01 9.18601778e-01]
 [4.02024891e-04 9.76759149e-01]
 [3.76580315e-01 9.73783538e-01]
 [6.04716101e-01 8.28845808e-01]]
=======================
[[0], [1], [1], [1], [1], [0], [0], [1], [1], [1], [0], [0], [0], [1], [0], [1], [0], [0], [0], [1], [0], [0], [1], [0], [1], [1], [1], [1], [1], [0], [1], [0], [1], [0], [0], [0], [1], [1], [0], [0], [0], [0], [0], [0], [0], [0], [0], [1], [0], [1], [1], [0], [0], [1], [0], [1], [0], [1], [0], [1], [1], [1], [0], [0], [1], [0], [1], [0], [0], [0], [1], [1], [1], [1], [1], [0], [1], [1], [1], [0], [1], [0], [1], [1], [0], [0], [1], [0], [1], [1], [1], [1], [0], [1], [0], [1], [0], [0], [1], [0], [0], [0], [1], [0], [0], [0], [1], [1], [1], [1], [1], [1], [0], [0], [0], [0], [0], [0], [1], [0], [0], [1], [0], [1], [0], [1], [0], [0]]
 

上一篇:Pytorch基础操作 —— 5. 标准化数据集接口 Dataset 与开源数据集


下一篇:【wikioi】1012 最大公约数和最小公倍数问题