PyTorch 张量的 strides 格式是什么
引言
尽管我已经使用 Numpy 和 PyTorch 好长一段时间了,但我一直不知道他们是如何实现底层的张量(tensor),而且这么高效。最近在看 Deep Learning Systems 这门课,终于有机会尝试自己实现张量,实现一遍之后对张量的理解更深刻了🧐
尽管我已经使用 Numpy 和 PyTorch 好长一段时间了,但我一直不知道他们是如何实现底层的张量(tensor),而且这么高效。最近在看 Deep Learning Systems 这门课,终于有机会尝试自己实现张量,实现一遍之后对张量的理解更深刻了🧐
Justin Gilmer 提出了 MPNN(Message Passing Neural Network)框架1 ,用于描述被用来做图上的监督学习的图神经网络模型。我发现这是一个很好用的框架,可以很好理解不同的 GNN 模型是如何工作的,方便快速弄清楚不同的 GNN 模型之间的差别。我们考虑图 $G$ 上的一个节点 $v$,它的向量表示 $h_v$ 的更新方式如下: $$m_v^{t+1}=\sum_{u\in \mathcal{N}(v)}M_t(h_v^t,h_u^t,e_{vu})$$ $$h_v^{t+1}=U_t(h_v^t,m_v^{t+1})$$
Modify your
reverseprocedure of exercise 2.18 to produce adeep-reverseprocedure that taks a list as argument and returns as its value the list with its elements reversed and with all sublists deep-reversed as well.
Several of the numerical methods described in this chapter are instances of an extremely general computational strategy known as iterative improvement. Iterative improvement says that, to compute something, we start with an initial guess for the answer, test if the guess is good enough, and otherwise improve the guess and continue the process using the improved guess as the new guess. Write a procedure
iterative-improvethat takes two procedures as arguments: a method for telling whether a guess is good enough and a method for improving a guess.Iterative-improveshould return as its value a procedure that takes a guess as argument and keeps improving the guess until it is good enough. Rewrite the sqrt procedure of section 1.1.7 and the fixed-point procedure of section 1.3.3 in terms of iterative-improve.