I was going through this VIT paper, what will it look like in torch , if we are trying to write this expression.
1 Answer
This itself isn't really an expression but a description of what $x_p$ looks like. Specifically, $x_p$ is a real-valued vector with the shape [N, P^2 * C]
. Of course, that data comes from your dataset, but as an example
torch.ones(N, P^2 * C, dtype=torch.float32)
# an example output for values N=2, P=2, C=1
>>> [[1., 1., 1., 1.],
[1., 1., 1., 1.]]
will give you a vector with the desired shape. Note that this will be a float32
vector, which makes it real-valued ($x_p \in R$).
[N, P^2 * C]
. Of course, that data comes from your dataset, but as an exampletorch.ones(N, P^2 * C, dtype=torch.float32)
will give you a vector with the same shape. Note that this will be a float32 vector, which makes it real-valued ($x_p \in \mathbb{R}$). $\endgroup$