Iām trying to do learn.show_results()
and I get ValueError: all the input arrays must have same number of dimensions, but the array at index 0 has 2 dimension(s) and the array at index 2 has 1 dimension(s)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-25-c3b657dcc9ae> in <module>()
----> 1 learn.show_results()
11 frames
/usr/local/lib/python3.6/dist-packages/fastai2/learner.py in show_results(self, ds_idx, dl, max_n, **kwargs)
322 b = dl.one_batch()
323 _,_,preds = self.get_preds(dl=[b], with_decoded=True)
--> 324 self.dbunch.show_results(b, preds, max_n=max_n, **kwargs)
325
326 def show_training_loop(self):
/usr/local/lib/python3.6/dist-packages/fastai2/data/core.py in show_results(self, b, out, max_n, ctxs, show, **kwargs)
83 x,y,its = self.show_batch(b, max_n=max_n, show=False)
84 b_out = b[:self.n_inp] + (tuple(out) if is_listy(out) else (out,))
---> 85 x1,y1,outs = self.show_batch(b_out, max_n=max_n, show=False)
86 res = (x,x1,None,None) if its is None else (x, y, its, outs.itemgot(slice(self.n_inp,None)))
87 if not show: return res
/usr/local/lib/python3.6/dist-packages/fastai2/data/core.py in show_batch(self, b, max_n, ctxs, show, **kwargs)
77 def show_batch(self, b=None, max_n=9, ctxs=None, show=True, **kwargs):
78 if b is None: b = self.one_batch()
---> 79 if not show: return self._pre_show_batch(b, max_n=max_n)
80 show_batch(*self._pre_show_batch(b, max_n=max_n), ctxs=ctxs, max_n=max_n, **kwargs)
81
/usr/local/lib/python3.6/dist-packages/fastai2/data/core.py in _pre_show_batch(self, b, max_n)
69 def _pre_show_batch(self, b, max_n=9):
70 "Decode `b` to be ready for `show_batch`"
---> 71 b = self.decode(b)
72 if hasattr(b, 'show'): return b,None,None
73 its = self._decode_batch(b, max_n, full=False)
/usr/local/lib/python3.6/dist-packages/fastai2/data/core.py in decode(self, b)
59 if isinstance(f,Pipeline): f.split_idx=split_idx
60
---> 61 def decode(self, b): return self.before_batch.decode(self.after_batch.decode(self._retain_dl(b)))
62 def decode_batch(self, b, max_n=9, full=True): return self._decode_batch(self.decode(b), max_n, full)
63
/usr/local/lib/python3.6/dist-packages/fastai2/core/transform.py in decode(self, o, full)
207
208 def decode (self, o, full=True):
--> 209 if full: return compose_tfms(o, tfms=self.fs, is_enc=False, reverse=True, split_idx=self.split_idx)
210 #Not full means we decode up to the point the item knows how to show itself.
211 for f in reversed(self.fs):
/usr/local/lib/python3.6/dist-packages/fastai2/core/transform.py in compose_tfms(x, tfms, is_enc, reverse, **kwargs)
147 for f in tfms:
148 if not is_enc: f = f.decode
--> 149 x = f(x, **kwargs)
150 return x
151
/usr/local/lib/python3.6/dist-packages/fastai2/core/transform.py in decode(self, x, **kwargs)
86 def use_as_item(self): return ifnone(self.as_item_force, self.as_item)
87 def __call__(self, x, **kwargs): return self._call('encodes', x, **kwargs)
---> 88 def decode (self, x, **kwargs): return self._call('decodes', x, **kwargs)
89 def setup(self, items=None): return self.setups(items)
90 def __repr__(self): return f'{self.__class__.__name__}: {self.use_as_item} {self.encodes} {self.decodes}'
/usr/local/lib/python3.6/dist-packages/fastai2/core/transform.py in _call(self, fn, x, split_idx, **kwargs)
93 if split_idx!=self.split_idx and self.split_idx is not None: return x
94 f = getattr(self, fn)
---> 95 if self.use_as_item or not is_listy(x): return self._do_call(f, x, **kwargs)
96 res = tuple(self._do_call(f, x_, **kwargs) for x_ in x)
97 return retain_type(res, x)
/usr/local/lib/python3.6/dist-packages/fastai2/core/transform.py in _do_call(self, f, x, **kwargs)
98
99 def _do_call(self, f, x, **kwargs):
--> 100 return x if f is None else retain_type(f(x, **kwargs), x, f.returns_none(x))
101
102 add_docs(Transform, decode="Delegate to `decodes` to undo transform", setup="Delegate to `setups` to set up transform")
/usr/local/lib/python3.6/dist-packages/fastai2/core/dispatch.py in __call__(self, *args, **kwargs)
96 if not f: return args[0]
97 if self.inst is not None: f = types.MethodType(f, self.inst)
---> 98 return f(*args, **kwargs)
99
100 def __get__(self, inst, owner):
/usr/local/lib/python3.6/dist-packages/fastai2/tabular/core.py in decodes(self, o)
155 def decodes(self, o):
156 cats,conts,targs = to_np(o)
--> 157 vals = np.concatenate([cats,conts,targs], axis=1)
158 df = pd.DataFrame(vals, columns=self.to.all_col_names)
159 to = self.to.new(df)
<__array_function__ internals> in concatenate(*args, **kwargs)
ValueError: all the input arrays must have same number of dimensions, but the array at index 0 has 2 dimension(s) and the array at index 2 has 1 dimension(s)
(This is on ADULTs)
Databunch was made like so:
trn_dl = TabDataLoader(to.train, bs=64, shuffle=True, drop_last=True)
val_dl = TabDataLoader(to.valid, bs=128)
dbunch = DataBunch(trn_dl, val_dl)