Aug-03-2022, 07:42 AM
Hello,
When I pass as input an array of shape (15,1) I get:
IndexError: index 15 is out of bounds for axis 0 with size 15
However, when I pass the same array after eliminating the second column, i.e. passing an array of shape (15,), then the error
disappears.
How could this be possible? Nothing else is changed between the two attempts.
The relevant piece of code is the following:
* Python version: 3.8.3 64-bit
* Qt version: 5.9.7
* PyQt5 version: 5.9.2
* Operating System: Windows 10
When I pass as input an array of shape (15,1) I get:
IndexError: index 15 is out of bounds for axis 0 with size 15
However, when I pass the same array after eliminating the second column, i.e. passing an array of shape (15,), then the error
disappears.
How could this be possible? Nothing else is changed between the two attempts.
The relevant piece of code is the following:
class curve: def __init__(self, lam, P11, F, extra): self.extra = extra self.lam = lam self.P11 = P11 self.F = F self.P11_pred = np.zeros(P11.shape) self.P11_pred[:] = np.NaN # Initialize a spot where later on the prediction can be stored def predict(self, model): self.P11_pred = model.predict([self.F, self.extra]) # Predict stress using the provided keras modelThe error log is the following:
Error: File D:\CANN-master\CANN-master\CANN\Inputs.py:198 in predict
self.P11_pred = model.predict([self.F, self.extra]) # Predict stress using the provided keras model
File ~\Anaconda3\envs\new_env\lib\site-packages\tensorflow\python\keras\engine\training_v1.py:983 in predict
return func.predict(
File ~\Anaconda3\envs\new_env\lib\site-packages\tensorflow\python\keras\engine\training_arrays.py:708 in predict
return predict_loop(
File ~\Anaconda3\envs\new_env\lib\site-packages\tensorflow\python\keras\engine\training_arrays.py:370 in model_iteration
ins_batch = slice_arrays(ins, batch_ids)
File ~\Anaconda3\envs\new_env\lib\site-packages\tensorflow\python\keras\utils\generic_utils.py:713 in slice_arrays
return [None if x is None else x[start] for x in arrays]
File ~\Anaconda3\envs\new_env\lib\site-packages\tensorflow\python\keras\utils\generic_utils.py:713 in <listcomp>
return [None if x is None else x[start] for x in arrays]
IndexError: index 15 is out of bounds for axis 0 with size 15
P.S I use Spyder version: 5.1.5 * Python version: 3.8.3 64-bit
* Qt version: 5.9.7
* PyQt5 version: 5.9.2
* Operating System: Windows 10