Skip to content

Commit

Permalink
Single-line TRT dynamic assertion (#8871)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher committed Aug 4, 2022
1 parent 38a6eb6 commit 731a2f8
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions models/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,7 @@ def forward(self, im, augment=False, visualize=False, val=False):
self.bindings['images'] = self.bindings['images']._replace(shape=im.shape)
self.bindings['output'].data.resize_(tuple(self.context.get_binding_shape(i_out)))
s = self.bindings['images'].shape
assert im.shape == s, f"image shape {im.shape} " + \
f"exceeds model max shape {s}" if self.dynamic else f"does not match model shape {s}"
assert im.shape == s, f"input size {im.shape} {'>' if self.dynamic else 'not equal to'} max model size {s}"
self.binding_addrs['images'] = int(im.data_ptr())
self.context.execute_v2(list(self.binding_addrs.values()))
y = self.bindings['output'].data
Expand Down

0 comments on commit 731a2f8

Please sign in to comment.