如果您尝试在numpy中创建具有大量维度的数组,则会引发异常:
In [1]: import numpy as np
In [2]: a = np.zeros((1,) * 33)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-2-32dc30f6e439> in <module>()
----> 1 a = np.zeros((1,) * 33)
ValueError: sequence too large; must be smaller than 32
这有什么简单的解决方法吗?
numpy不允许创建此类数组的原因是什么?
答案 0 :(得分:6)
.directive('priceMonthly', function() {
return {
restrict: 'A',
scope:{
priceMonthly:"=",
period:"="
},
link: function(scope) {
scope.$watch('period',function(newval){
if(newval=='monthly')
scope.priceMonthly = scope.priceMonthly*12;
if(newval=='yearly')
scope.priceMonthly = scope.priceMonthly/12;
})
}
};});
您可以更改这些定义并从源代码构建符合您需求的不兼容版本。