Skip to content
DeepForgeby svx
All problems
EasyNLPnlp-380

Residual Connection Addition

Problem

A residual connection adds the sublayer output back to its input elementwise.

Given the input vector and the sublayer output, return their sum.

Hint

Coordinatewise addition.

Test cases

case 1
in: [[1,2],[0.5,-0.5]]
expected: [1.5,1.5]
case 2
in: [[0,0],[1,1]]
expected: [1,1]
case 3
in: [[1],[1]]
expected: [2]
Starter codePython
def residual_connection_addition(x, sublayer):
    # Your code here
    pass

3 test cases · run your code against them in the editor