From f88192831fe21451f6ada164aa8e831246b782a2 Mon Sep 17 00:00:00 2001 From: Phil Wang Date: Tue, 31 May 2022 19:49:35 -0700 Subject: [PATCH] fall in line with trim logic in enformer master --- enformer_pytorch/modeling_enformer.py | 4 ++++ setup.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/enformer_pytorch/modeling_enformer.py b/enformer_pytorch/modeling_enformer.py index af587c0..2034bb8 100644 --- a/enformer_pytorch/modeling_enformer.py +++ b/enformer_pytorch/modeling_enformer.py @@ -174,6 +174,10 @@ def forward(self, x): raise ValueError(f'sequence length {seq_len} is less than target length {target_len}') trim = (target_len - seq_len) // 2 + + if trim == 0: + return x + return x[:, -trim:trim] def ConvBlock(dim, dim_out = None, kernel_size = 1): diff --git a/setup.py b/setup.py index 67dd287..de3da82 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ name = 'enformer-pytorch', packages = find_packages(exclude=[]), include_package_data = True, - version = '0.4.6', + version = '0.4.7', license='MIT', description = 'Enformer - Pytorch', author = 'Phil Wang',