Twice Plus One
Return a tensor with every element of x doubled, and then 1 added to it.
Example 1
x [1.0,2.0,-3.0]
returns [3.0,5.0,-5.0]
Constraints
xhas 1 or 2 dimensions
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More PyTorch problems
- Two RowsBeginner
- A Layer by HandEasy
- Center the ColumnsEasy
- Daily ReturnsEasy
- End to EndEasy
- Floor at ZeroEasy
- Matrix Times MatrixEasy
- One HotEasy