在numpy中,我有两个"数组",X是(m,n)和y是一个向量(n,1)
运用
X*y
Run Code Online (Sandbox Code Playgroud)
我收到了错误
ValueError: operands could not be broadcast together with shapes (97,2) (2,1)
Run Code Online (Sandbox Code Playgroud)
什么时候 (97,2)x(2,1)显然是一个法律矩阵操作,应该给我一个(97,1)向量
编辑:
我已经纠正了这一点,X.dot(y)但原始问题仍然存在.
我有以下两种看法
def home(request):
levels = levelData.objects.all()
context ={
"levels" : levels
}
print "abcde"
return render(request, 'home.html', context)
Run Code Online (Sandbox Code Playgroud)
另一个
def create(request):
if request.method == "POST":
# doing something with data with saveData as variable of model type
saveData.save()
return redirect('home')
return render(request, 'create.html')
Run Code Online (Sandbox Code Playgroud)
现在,在创建视图中,我希望在保存数据后重定向到主视图。重定向工作正常,正在执行主页视图中的打印语句并在终端中打印“ abcde”时,它已重定向到主页。但是,home.html不会呈现,而是保留在create.html上。同样,URL不变。
这是我的urls.py中的主视图
url(r'^$', home, name='home'),
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?