Rename onnx_dynamic -> dynamic (#9168)
parent
f2b8f3fe3a
commit
85d7ae2195
|
@ -489,7 +489,7 @@ def run(
|
|||
for k, m in model.named_modules():
|
||||
if isinstance(m, Detect):
|
||||
m.inplace = inplace
|
||||
m.onnx_dynamic = dynamic
|
||||
m.dynamic = dynamic
|
||||
m.export = True
|
||||
|
||||
for _ in range(2):
|
||||
|
|
|
@ -37,7 +37,7 @@ except ImportError:
|
|||
|
||||
class Detect(nn.Module):
|
||||
stride = None # strides computed during build
|
||||
onnx_dynamic = False # ONNX export parameter
|
||||
dynamic = False # force grid reconstruction
|
||||
export = False # export mode
|
||||
|
||||
def __init__(self, nc=80, anchors=(), ch=(), inplace=True): # detection layer
|
||||
|
@ -60,7 +60,7 @@ class Detect(nn.Module):
|
|||
x[i] = x[i].view(bs, self.na, self.no, ny, nx).permute(0, 1, 3, 4, 2).contiguous()
|
||||
|
||||
if not self.training: # inference
|
||||
if self.onnx_dynamic or self.grid[i].shape[2:4] != x[i].shape[2:4]:
|
||||
if self.dynamic or self.grid[i].shape[2:4] != x[i].shape[2:4]:
|
||||
self.grid[i], self.anchor_grid[i] = self._make_grid(nx, ny, i)
|
||||
|
||||
y = x[i].sigmoid()
|
||||
|
|
Loading…
Reference in New Issue