Previous question · 193
Confusion matrix
easyML Coding
Next question · 195
Monty Hall Simulation
easyStatistics
Random coding question

194. Positional embeddings for images

medium
GeneralGeneral
manager
Function contract
Inputs
width
int
height
int
d_model
int
Returns
value
np.ndarray

Examples

Input
{
  "width": 3,
  "height": 2,
  "d_model": 4
}
Output
[
  [
    0,
    1,
    0,
    1
  ],
  [
    0,
    1,
    0.8414709848078965,
    0.5403023058681398
  ],
  [
    0,
    1,
    0.9092974268256817,
    -0.4161468365471424
  ],
  [
    0.8414709848078965,
    0.5403023058681398,
    0,
    1
  ],
  [
    0.8414709848078965,
    0.5403023058681398,
    0.8414709848078965,
    0.5403023058681398
  ],
  [
    0.8414709848078965,
    0.5403023058681398,
    0.9092974268256817,
    -0.4161468365471424
  ]
]

Constraints

Hint 1
Hint 2
Hint 3
Roles
ML Engineer
AI Engineer
Data Scientist
Research Scientist
Companies
GeneralGeneral
Levels
manager
staff
senior
Tags
sinusoidal-embeddings
vision-transformers
broadcasting
positional-encoding

Similar Questions

Linear Regressionmedium
ML Coding
Activation function relueasy
ML Coding
Text normalizationmedium
ML Coding
22 people are solving this problem
Loading editor for the selected language
Ln 1, Col 1
Program Output
DATAINTERVIEW
Interactive coding terminal
Python / NumPy environment ready.
Type a command below or run code from the editor.
run scriptExecute the current editor contents
submitGrade the current editor contents against all solution test cases
python ("print hello world")Run an isolated Python command
helpShow all available commands