Skip to content
DeepForgeby svx
All problems
MediumComputer Visioncv-358

I3D Inflation Weight Reuse

Problem

Inflate 2D convolution weights to 3D by temporal replication (I3D).

Each 2D weight is repeated kt times along the temporal axis and divided by kt so the response magnitude is preserved. Return the flattened inflated kernel with every value rounded to 4 decimal places.

Hint

Division by kt keeps a constant temporal input from amplifying the filter response.

Test cases

case 1
in: [[2,-4],2]
expected: [1,1,-2,-2]
case 2
in: [[3],3]
expected: [1,1,1]
case 3
in: [[1.5,0.5],4]
expected: [0.375,0.375,0.375,0.375,0.125,0.125,0.125,0.125]
case 4
in: [[-2,2],1]
expected: [-2,2]
Starter codePython
def inflate_weights(w2d, kt):
    # Your code here
    pass

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