Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions tester/api_config/config_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,27 @@ def get_padding_offset(bsz, max_seq_len, seq_lens_this_time):
A = numpy.random.uniform(low=0.5, high=1.0, size=self.shape).astype(self.dtype)
A_T = numpy.swapaxes(A, -1, -2)
self.numpy_tensor = numpy.matmul(A, A_T) + numpy.eye(n, dtype=self.dtype)
elif api_config.api_name.endswith("pinv"):
if self.check_arg(api_config, 0, "x") and self.get_arg(api_config, 2, " hermitian"):
is_complex = self.dtype.startswith("complex")
if len(self.shape) not in [2, 3]:
raise ValueError("pinv only supports 2D or 3D tensors")
if is_complex:
if self.dtype == "complex64":
real_dtype = numpy.float32
elif self.dtype == "complex128":
real_dtype = numpy.float64
A_real = numpy.random.randn(*self.shape).astype(real_dtype)
A_imag = numpy.random.randn(*self.shape).astype(real_dtype)
A = A_real + 1j * A_imag
A = A.astype(self.dtype)
else:
A = numpy.random.randn(*self.shape).astype(self.dtype)
if len(self.shape) == 2:
A_T = A.conj().T if is_complex else A.T
else:
A_T = numpy.conj(A).swapaxes(-2, -1) if is_complex else A.swapaxes(-2, -1)
self.numpy_tensor = (A + A_T) / 2
elif api_config.api_name == "paddle.linspace":
if "int" in self.dtype:
self.numpy_tensor = (numpy.random.randint(0, 65535, size=self.shape)).astype(self.dtype)
Expand Down
1 change: 1 addition & 0 deletions tester/base_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ forward_only_apis:
- partial_allgather
- partial_recv
- partial_send
- pinv
- print
- prior_box
- prune_gate_by_capacity
Expand Down