Skip to content
DeepForgeby svx
All problems
EasyComputer Visioncv-087

Conv Parameter Count

Problem

Count the trainable parameters of a 2D convolution layer.

The weight tensor has cin * cout * k * k entries; when bias is True add cout bias values. Return the integer total.

Test cases

case 1
in: [3,16,3,true]
expected: 448
case 2
in: [1,1,3,false]
expected: 9
case 3
in: [3,64,3,true]
expected: 1792
case 4
in: [64,128,1,false]
expected: 8192
Starter codePython
def conv_param_count(cin, cout, k, bias):
    # Your code here
    pass

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