如何解决“只能将整数标量数组转换为标量索引”

时间:2019-10-23 06:34:18

标签: python

我收到以下代码的奇怪错误:


 <script
    src="https://www.paypal.com/sdk/js?client-id=Af_V3NNV2RUksS5sfObGCirO3gTXSFuetygoYta5-zU-ROGToia5dceU9cT5DBL821zc-ihtNQydiqsf&currency=GBP&intent=capture&disable-funding=card,bancontact,sepa,ideal,sofort" data-order-id="2VW94544JM6797511">
  </script>

    <div id="paypal-button-container"></div>

    <script>
  paypal.Buttons({
    createOrder: function(data, actions) {
      return actions.order.create({
        purchase_units: [{
          amount: {
            value: '25.20'
          }
        }]

      });
    },
    onApprove: function(data, actions) {
      // Capture the funds from the transaction
      return actions.order.capture().then(function(details) {
        // Show a success message to your buyer
        alert('Transaction completed by ' + details.payer.name.given_name + ' ' + details.payer.name.surname + ' ' + details.payer.email_address + ' ' + details.purchase_units[0].amount.currency_code + details.purchase_units[0].amount.value + ' ' +  details.purchase_units[0].shipping.address.address_line_1);



      });


    }
  }).render('#paypal-button-container');
</script>

这里import numpy as np w=np.random.rand(100,10) x=np.random.rand(200,100) y= np.random.rand(200,10) def compute( x, y): numpy_x = np.array(x) numpy_y = np.array(y) zeross = np.zeros(np.shape(x)[0]) oness = np.ones(np.shape(x)[0]) result= np.zeros((np.shape(x)[0],np.shape(y)[1])) for i in range(np.shape(x)[1]): for j in range(np.shape(y)[1]): result[i,j] = w[i,j]+np.max(zeross, np.subtract(oness,w[:,j].dot(np.transpose(numpy_x)))).dot(numpy_x[:,i]*(numpy_y[:,j]*-1)) return result print(compute(x,y)) x矩阵,100 by 100y矩阵100 by 5w矩阵 我得到的错误是:

  

测试失败:只能将整数标量数组转换为标量索引

编译器似乎表明库中有错误?

100 by 5

请帮助

0 个答案:

没有答案