tools, lockfile, deps
This commit is contained in:
23
tools/calculate_conv_dimensions.py
Normal file
23
tools/calculate_conv_dimensions.py
Normal file
@@ -0,0 +1,23 @@
|
||||
def calculate_conv_dimensions(W_in, H_in, K, S, P):
|
||||
"""
|
||||
Calculate the output dimensions of a convolutional layer.
|
||||
|
||||
Parameters:
|
||||
W_in (int): Width of the input image
|
||||
H_in (int): Height of the input image
|
||||
K (int): Size of the filter (assumed to be square)
|
||||
S (int): Stride
|
||||
P (int): Padding
|
||||
|
||||
Returns:
|
||||
(int, int): Width and height of the output activation map
|
||||
"""
|
||||
W_out = (W_in - K + (2 * P)) / S + 1
|
||||
H_out = (H_in - K + (2 * P)) / S + 1
|
||||
|
||||
return W_out, H_out
|
||||
|
||||
|
||||
print(f"w, h = {calculate_conv_dimensions(W_in=2048, H_in=32, K=11, S=4, P=2)=}")
|
||||
# w, h = calculate_conv_dimensions(W_in=2048, H_in=32, K=11, S=4, P=2)
|
||||
# print(f"{calculate_conv_dimensions(W_in=w, H_in=h, K=11, S=4, P=2)=}")
|
||||
Reference in New Issue
Block a user