0
$\begingroup$

I was going through this VIT paper, what will it look like in torch , if we are trying to write this expression.

enter image description here

$\endgroup$
3
  • 2
    $\begingroup$ 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) 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$
    – Chillston
    Jun 22, 2022 at 7:11
  • 1
    $\begingroup$ @Chillston You could write that as an answer instead of a comment. $\endgroup$ Jun 22, 2022 at 8:15
  • $\begingroup$ Of course, sorry $\endgroup$
    – Chillston
    Jun 22, 2022 at 8:22

1 Answer 1

2
$\begingroup$

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$).

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .