AttributeError: 'numpy.ndarray' object has no attribute 'cpu'
Closed this issue · 3 comments
NitinDatta8 commented
Need some help in solving this issue
while running "feature_extractor" I get this error:
36 for i, (dir, vid_name, start_frame) in enumerate(zip(dirs, vid_names, sampled_idx.cpu().numpy())):
37 dir = path.join(save_dir, dir)
---> 38 features_writer.write(feature=outputs[i], video_name=vid_name, idx=start_frame, dir=dir)
39
40 features_writer.dump()
<ipython-input-7-563b8b257603> in write(self, feature, video_name, idx, dir)
48 self._init_video(video_name, dir)
49
---> 50 self.store(feature, idx)
<ipython-input-7-563b8b257603> in store(self, feature, idx)
38
39 def store(self, feature, idx):
---> 40 self.data[idx] = list(feature.cpu().numpy())
41
42 def write(self, feature, video_name, idx, dir):
AttributeError: 'numpy.ndarray' object has no attribute 'cpu'
Anyone facing the same issue? Or if anyone who has solved this can help
PHDPeter commented
I think I have had this before but can't remember why.
Could you give me the "type()" of the feature variable? maybe from just before the call at 40?
NitinDatta8 commented
Thank you I solved this error
We can close this issue
xywhat commented
Thank you I solved this error We can close this issue
how?thank you