Problems
Previous question · 317
Max Consecutive Ones III
medium
Algorithms
Next question · 319
No Reaction Rate
hard
Database
Random coding question
NumPy
Language
NumPy
Practice
Interview
AI Tutor
Description
Solution
Discussion
318. Positional encoding
medium
General
senior
Function contract
Inputs
d_model
int
seq_len
int
Returns
value
np.ndarray
Examples
Example 1
Input
{
"d_model"
:
1
,
"seq_len"
:
1
}
Output
[
[
0
]
]
Example 2
Input Signature
Argument
Type
d_model
int
seq_len
int
Output Signature
Return Name
Type
value
np.ndarray
Constraints
Hint 1
Hint 2
Hint 3
Roles
ML Engineer
AI Engineer
Data Scientist
Research Scientist
Companies
General
Levels
senior
entry
Tags
positional-encoding
numpy-broadcasting
transformers
sin-cos-embeddings
Similar Questions
Linear Regression
medium
ML Coding
Activation function relu
easy
ML Coding
Text normalization
medium
ML Coding
16 people
are solving this problem
Run
Submit
00:00
Loading editor for the selected language
Ln 1, Col 1
Program Output
DATA
INTERVIEW
Interactive coding terminal
Python / NumPy environment ready.
Type a command below or run code from the editor.
run script
Execute the current editor contents
submit
Grade the current editor contents against all solution test cases
python ("print hello world")
Run an isolated Python command
help
Show all available commands
>>>