mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2026-04-23 00:17:25 +08:00
[BugFix][Optimization] Replace silent failures with catchable exceptions and informative error messages (#6533)
* init * init * fix format * add * add files * add ut * fix some * add ut * add more * add * fix pre-commit * fix pre-commit * fix cover * skip long seq * add * add * fix * remove not need * fix set attr * fix comments * fix comments * fix failed tests --------- Co-authored-by: gongweibao <gognweibao@baidu.com>
This commit is contained in:
@@ -51,7 +51,7 @@ class BitMaskTracker:
|
||||
end (int): End index (exclusive)
|
||||
"""
|
||||
if start < 0 or end > self.length or start >= end:
|
||||
raise ValueError("Invalid mark range")
|
||||
raise ValueError(f"Invalid mark range: start={start}, end={end}, length={self.length}")
|
||||
block = ((1 << (end - start)) - 1) << start
|
||||
self.mask |= block
|
||||
|
||||
@@ -82,7 +82,7 @@ class TensorTracker:
|
||||
self.track_dim = 2 if output_dim else 1
|
||||
self.trackers = [BitMaskTracker(shape[self.track_dim]) for _ in range(batch)]
|
||||
else:
|
||||
raise ValueError("Only 2D or 3D tensors supported")
|
||||
raise ValueError(f"Only 2D or 3D tensors supported, got {len(shape)}D tensor with shape={shape}")
|
||||
|
||||
def mark(self, start: int = 0, end: int = None, batch_id: int = None):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user