dearleiii / PIRM-2018-SISR-Challenge

Super Resolution
https://www.pirm2018.org/PIRM-SR.html
2 stars 0 forks source link

Scores size: [100], should be score:: torch.Size([100, 1]) outputs: torch.Size([100, 1]) #3

Closed dearleiii closed 6 years ago

dearleiii commented 6 years ago

  File "/home/home2/leichen/.local/lib/python3.5/site-packages/torch/nn/functional.py", line 1569, in mse_loss     input, target, size_average, reduce)   File "/home/home2/leichen/.local/lib/python3.5/site-packages/torch/nn/functional.py", line 1537, in _pointwise_loss     return lambd_optimized(input, target, size_average, reduce) RuntimeError: input and target shapes do not match: input [100 x 1], target [100] at /pytorch/aten/src/THNN/generic/MSECriterion.c:13

dearleiii commented 6 years ago

Reason: Change scores format from following 1 row to 100 rows * 1 col.

3 inputs: torch.Size([100, 3, 1020, 2040]) scores: torch.Size([100]) tensor([ 3.1327, 5.0996, 4.5911, 2.8478, 3.2285, 5.6424, 3.1004, 3.4503, 5.1741, 6.5591, 2.7818, 2.4853, 3.1856, 4.2778, 5.4148, 3.3960, 3.4397, 3.5407, 2.7597, 3.4130, 4.1706, 3.3619, 4.7398, 6.9144, 6.2340, 2.9429, 3.0453, 5.2743, 5.6257, 6.3857, 4.5774, 3.4371, 3.0139, 3.0674, 3.4487, 2.9258, 5.1968, 5.0513, 3.1483, 5.5532, 6.3968, 3.2522, 2.8573, 2.7773, 3.1915, 5.1089, 3.8193, 2.4077, 3.3411, 3.0841, 4.9376, 2.5779, 3.2316, 3.2316, 2.9469, 2.8745, 3.2610, 3.1034, 2.6263, 4.4909, 5.0312, 6.1274, 3.4059, 4.9771, 3.3329, 3.2355, 6.9908, 3.5320, 5.0356, 5.3224, 5.5095, 6.4037, 3.1418, 2.3223, 4.0391, 3.8674, 5.0902, 5.4016, 2.5889, 3.4109, 4.7564, 2.8584, 6.5429, 3.1023, 2.9150, 2.4756, 3.1263, 3.6646, 3.0826, 3.3422, 4.2916, 3.4340, 7.4813, 4.7406, 5.4785, 2.3897, 3.0281, 3.3865, 3.5012, 5.4615]) 4 inputs: torch.Size([100, 3, 1020, 2040]) scores: torch.Size([100]) tensor([ 4.9026, 6.2377, 5.6118, 6.3311, 2.6798, 5.1994, 3.5280, 2.0590, 3.0837, 3.1287, 3.3075, 4.2201, 2.5837, 3.6220, 5.3468, 3.2552, 2.5161, 3.6769, 2.6811, 3.9029, 6.2238, 2.9773, 5.3219, 2.8499, 2.9047, 3.5606, 2.7024, 2.9679, 5.2580, 3.0199, 2.5537, 5.4517, 6.6979, 4.9666, 3.6384, 2.7030, 4.3570, 2.3549, 2.8705, 5.3831, 3.5013, 3.3693, 2.6860, 5.5270, 4.1685, 3.4887, 2.9090, 2.8505, 2.8628, 2.7233, 2.8973, 3.0046, 4.8898, 2.8524, 3.5670, 3.3282, 3.1370, 3.4076, 2.4438, 2.9002, 5.2261, 3.1163, 4.0014, 3.1474, 3.8466, 2.6916, 2.7902, 5.1269, 6.7171, 5.8369, 3.9422, 5.1962, 3.5826, 5.5372, 5.1789, 5.5083, 4.3748, 3.6680, 3.2742, 6.3425, 2.5078, 2.8409, 2.5019, 5.2732, 5.2444, 5.1953, 4.8479, 3.9562, 3.4074, 3.9643, 2.5699, 3.5463, 5.2205, 3.5973, 2.5979, 2.9234, 3.0934, 5.9013, 3.2829, 4.3284])

dearleiii commented 6 years ago

Goal format:

..... [ 3.5441], [ 2.9496], [ 2.9471], [ 3.2084], [ 3.2459], [ 4.2759], [ 4.1994], [ 2.7597], [ 3.4700], [ 3.7467], [ 3.6837], [ 3.9614], [ 3.5501], [ 4.8162], [ 3.3725], [ 3.4439], [ 3.0167], [ 3.8090], [ 3.7571], [ 3.2593], [ 3.4074]])

dearleiii commented 6 years ago

torch.unsqueeze(input, dim, out=None) → Tensor

Returns a new tensor with a dimension of size one inserted at the specified position.

The returned tensor shares the same underlying data with this tensor.

Example:

x = torch.tensor([1, 2, 3, 4]) torch.unsqueeze(x, 0) tensor([[ 1, 2, 3, 4]]) torch.unsqueeze(x, 1) tensor([[ 1], [ 2], [ 3], [ 4]])