質問編集履歴
1
エラー全文の追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -92,8 +92,108 @@
|
|
92
92
|
|
93
93
|
```bash
|
94
94
|
|
95
|
+
================================================================================================ FAILURES =================================================================================================
|
96
|
+
|
97
|
+
________________________________________________________________________________________ test_run_backbone_on_gpu _________________________________________________________________________________________
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
@pytest.mark.skipif(not torch.cuda.is_available(), reason="There is no GPU")
|
102
|
+
|
103
|
+
def test_run_backbone_on_gpu():
|
104
|
+
|
105
|
+
back = Backbone()
|
106
|
+
|
107
|
+
dummy_input = torch.from_numpy(np.random.random((1, 3, 224, 224))).to(
|
108
|
+
|
109
|
+
"cuda", dtype=torch.float
|
110
|
+
|
111
|
+
)
|
112
|
+
|
113
|
+
back = back.cuda()
|
114
|
+
|
115
|
+
> dummy_output = back(dummy_input)
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
tests/test_model.py:43:
|
120
|
+
|
121
|
+
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
122
|
+
|
123
|
+
.venv/lib/python3.8/site-packages/torch/nn/modules/module.py:722: in _call_impl
|
124
|
+
|
125
|
+
result = self.forward(*input, **kwargs)
|
126
|
+
|
127
|
+
src/model.py:16: in forward
|
128
|
+
|
129
|
+
return model(x)
|
130
|
+
|
131
|
+
.venv/lib/python3.8/site-packages/torch/nn/modules/module.py:722: in _call_impl
|
132
|
+
|
133
|
+
result = self.forward(*input, **kwargs)
|
134
|
+
|
135
|
+
.venv/lib/python3.8/site-packages/torchvision/models/_utils.py:63: in forward
|
136
|
+
|
137
|
+
x = module(x)
|
138
|
+
|
139
|
+
.venv/lib/python3.8/site-packages/torch/nn/modules/module.py:722: in _call_impl
|
140
|
+
|
141
|
+
result = self.forward(*input, **kwargs)
|
142
|
+
|
143
|
+
.venv/lib/python3.8/site-packages/torch/nn/modules/conv.py:419: in forward
|
144
|
+
|
145
|
+
return self._conv_forward(input, self.weight)
|
146
|
+
|
147
|
+
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
self = Conv2d(3, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False)
|
152
|
+
|
153
|
+
input = tensor([[[[0.1313, 0.0234, 0.7552, ..., 0.3833, 0.4139, 0.8594],
|
154
|
+
|
155
|
+
[0.1304, 0.7056, 0.5246, ..., 0.4825, 0.6..., 0.3003, 0.3479, 0.5493],
|
156
|
+
|
157
|
+
[0.3813, 0.9502, 0.2774, ..., 0.6596, 0.5868, 0.9608]]]],
|
158
|
+
|
159
|
+
device='cuda:0')
|
160
|
+
|
161
|
+
weight = Parameter containing:
|
162
|
+
|
163
|
+
tensor([[[[-4.6613e-02, -9.6919e-04, 8.5332e-03, ..., 2.0174e-02,
|
164
|
+
|
165
|
+
9.1100e-03, -4....[-2.4699e-02, 1.7219e-02, -1.9792e-02, ..., -7.8135e-03,
|
166
|
+
|
167
|
+
-3.0772e-02, -1.7609e-02]]]], requires_grad=True)
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
def _conv_forward(self, input, weight):
|
172
|
+
|
173
|
+
if self.padding_mode != 'zeros':
|
174
|
+
|
175
|
+
return F.conv2d(F.pad(input, self._reversed_padding_repeated_twice, mode=self.padding_mode),
|
176
|
+
|
177
|
+
weight, self.bias, self.stride,
|
178
|
+
|
179
|
+
_pair(0), self.dilation, self.groups)
|
180
|
+
|
181
|
+
> return F.conv2d(input, weight, self.bias, self.stride,
|
182
|
+
|
183
|
+
self.padding, self.dilation, self.groups)
|
184
|
+
|
185
|
+
E RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
.venv/lib/python3.8/site-packages/torch/nn/modules/conv.py:415: RuntimeError
|
190
|
+
|
191
|
+
========================================================================================= short test summary info =========================================================================================
|
192
|
+
|
95
193
|
FAILED tests/test_model.py::test_run_backbone_on_gpu - RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same
|
96
194
|
|
195
|
+
|
196
|
+
|
97
197
|
```
|
98
198
|
|
99
199
|
|