This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random, math | |
| #---helper functions | |
| def is_conflicting_points(point1, point2): | |
| # compare x axis | |
| if abs(point1.x - point2.x) > CONFLICT_RADIUS: return False | |
| # compare y axis | |
| elif abs(point1.y - point2.y) > CONFLICT_RADIUS: return False | |
| # box compare | |
| elif abs(point1.x - point2.x) <= conflicting_box_size and abs(point1.y - point2.y) <= conflicting_box_size: return True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ConvLSTMCell(nn.Module): | |
| def __init__(self, input_size, input_dim, hidden_dim, kernel_size, bias): | |
| """ | |
| Initialize ConvLSTM cell. | |
| Parameters | |
| ---------- | |
| input_size: (int, int) | |
| Height and width of input tensor as (height, width). |