Commit 776010d3 authored by Catheriany's avatar Catheriany
Browse files

issue/228: 更新测试

parent aeeae7ea
...@@ -98,7 +98,7 @@ std::vector<std::string> Test::tensor_names() { ...@@ -98,7 +98,7 @@ std::vector<std::string> Test::tensor_names() {
} }
std::vector<std::string> Test::output_names() { std::vector<std::string> Test::output_names() {
return {"y"}; return {};
} }
std::string Test::toString() const { std::string Test::toString() const {
......
...@@ -110,7 +110,7 @@ std::vector<std::string> Test::tensor_names() { ...@@ -110,7 +110,7 @@ std::vector<std::string> Test::tensor_names() {
} }
std::vector<std::string> Test::output_names() { std::vector<std::string> Test::output_names() {
return {"result"}; return {};
} }
std::string Test::toString() const { std::string Test::toString() const {
......
...@@ -37,18 +37,13 @@ def contiguous_gguf_strides(shape: tuple[int, ...]) -> list[int]: ...@@ -37,18 +37,13 @@ def contiguous_gguf_strides(shape: tuple[int, ...]) -> list[int]:
acc *= size acc *= size
return strides[::-1] return strides[::-1]
def process_zero_stride_tensor(a, b, stride_a=None, stride_b=None): def process_zero_stride_tensor(tensor, stride=None):
def normalize_stride(tensor, stride):
if stride: if stride:
slices = tuple(slice(0, 1) if s == 0 else slice(None) for s in stride) slices = tuple(slice(0, 1) if s == 0 else slice(None) for s in stride)
return tensor[slices] return tensor[slices]
else: else:
return tensor return tensor
a_unique = normalize_stride(a, stride_a)
b_unique = normalize_stride(b, stride_b)
return a_unique, b_unique
class InfiniopTestCase: class InfiniopTestCase:
op_name: str op_name: str
......
...@@ -100,7 +100,8 @@ if __name__ == "__main__": ...@@ -100,7 +100,8 @@ if __name__ == "__main__":
a = np.random.rand(*shape).astype(dtype) a = np.random.rand(*shape).astype(dtype)
b = np.random.rand(*shape).astype(dtype) b = np.random.rand(*shape).astype(dtype)
c = np.empty(tuple(0 for _ in shape), dtype=dtype) c = np.empty(tuple(0 for _ in shape), dtype=dtype)
a, b = process_zero_stride_tensor(a, b, stride_a, stride_b) a = process_zero_stride_tensor(a, stride_a)
b = process_zero_stride_tensor(b, stride_b)
test_case = AddTestCase( test_case = AddTestCase(
a=a, a=a,
shape_a=shape, shape_a=shape,
......
...@@ -102,7 +102,8 @@ if __name__ == "__main__": ...@@ -102,7 +102,8 @@ if __name__ == "__main__":
a = np.random.rand(*shape).astype(dtype) a = np.random.rand(*shape).astype(dtype)
b = np.random.rand(*shape).astype(dtype) b = np.random.rand(*shape).astype(dtype)
c = np.empty(tuple(0 for _ in shape), dtype=dtype) c = np.empty(tuple(0 for _ in shape), dtype=dtype)
a, b = process_zero_stride_tensor(a, b, stride_a, stride_b) a = process_zero_stride_tensor(a, stride_a)
b = process_zero_stride_tensor(b, stride_b)
test_case = SwiGLUTestCase( test_case = SwiGLUTestCase(
a=a, a=a,
shape_a=list(shape), shape_a=list(shape),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment