Ошибка конструктора общей переменной Theano

#python #numpy #theano

#python #numpy #theano

Вопрос:

веса — это список Numpy ndarray

 WEIGHTS = []  
for weight in weights:  
    WEIGHTS.append(Theano.shared(Numpy.array(weight), dtype = Theano.config.floatX))
  

Ошибка:

  No suitable SharedVariable constructor could be found. Are you sure all kwargs are supported? We do not support the parameter dtype or type. value="[[-0.59437655 -0.66183091 -0.49330967  0.5341272  -0.71235842 -0.5309111
  -0.41950136  0.76606105  0.63401357 -0.66799208 -0.13825129 -0.64355341
  -0.08321964  0.78879952  0.38723046 -0.80254236]
 [-0.00340653 -0.68424882  0.73717993 -0.03259952  0.01908119 -0.27347914
  -0.54578049 -0.64197806 -0.70909294 -0.8278319  -0.54029437 -0.41299341
   0.50841491 -0.4404315   0.0034083  -0.81478237]
 [-0.20577933 -0.09402267 -0.51729256  0.13291719 -0.18898014 -0.54618225
  -0.38046483  0.91222028 -0.32784083  0.54191663  0.59148461 -0.34773102
  -0.71356567  0.75372991  0.57200978 -1.00560169]
 [ 0.97094749 -1.04304354 -0.15371007  0.73932224 -0.7284857   0.17841782
  -0.05476279 -0.30589505 -0.67929633  0.8480269   0.22350553 -0.04623159
  -0.84297018  0.25937871 -0.46716392  0.51133557]
 [ 0.00915791 -0.04072289  0.38978791 -0.12274089 -0.30497646  0.16863023
  -0.16831554  0.10480249 -0.82082575  0.0604674   0.61837916 -0.71897132
  -0.63089596 -0.29704382  0.66048502  0.05797768]
 [-0.00160207  0.19007147  0.1006495   0.39384944 -0.67329269 -0.37062895
   0.78985188  0.72247071  0.72813554 -0.23919282 -0.54938919 -0.70114392
   0.83733916 -0.15144549 -0.81298212  0.34608201]
 [-0.37888527  0.57368407 -0.23682759 -0.02748364  0.21932119  0.68937528
  -0.57860715 -0.84222829  0.00630163  0.24761677  0.85834009  0.77399599
   0.57457557  0.73063443 -0.3520059  -0.04101319]
 [ 0.58357881  0.49840153 -0.33299835  0.43245037 -0.49692561  0.08307794
  -0.39417695  0.45403968 -0.2331192  -0.44734402  0.63857672  0.11523024
  -0.00893871  0.25680397 -0.57907839  0.15743863]
 [ 0.31255415  0.58321199 -0.30659539  0.17275353 -0.78450044 -0.63778058
  -0.36795226 -0.19436784 -0.44348407  0.77695667 -0.71754174  0.4312374
  -0.48059778 -0.45765487 -0.44493203  0.00242202]]". parameters="{'dtype': 'float64'}"
  

Ответ №1:

Общая функция не поддерживает параметр dtype. Это numpy, которые его поддерживают. Ошибка устранена!