Hi all,
I’m trying to create a converter for ONNX Resize
these days. As far as I see relay/frontend/onnx.py
, a conveter for Resize is not implemented now.
But I’m having difficulty because ONNX Resize is generalized to N dim and has recursion.
I guess I need to simulate this function in relay.
def interpolate_nd_with_x(data, # type: np.ndarray
n, # type: int
scale_factors, # type: List[float]
x, # type: List[float]
get_coeffs, # type: Callable[[float], np.ndarray]
roi=None, # type: np.ndarray
**kwargs # type: Any
): # type: (...) -> np.ndarray
if n == 1:
return interpolate_1d_with_x(data, scale_factors[0], x[0], get_coeffs, roi=roi,
**kwargs)
return interpolate_1d_with_x(
[interpolate_nd_with_x(data[i], n - 1, scale_factors[1:], x[1:], get_coeffs,
roi=None if roi is None else np.concatenate(
[roi[1:n], roi[n + 1:]]),
**kwargs)
for i in range(data.shape[0])], scale_factors[0], x[0], get_coeffs,
roi=None if roi is None else [roi[0], roi[n]], **kwargs)
How can I implement a converter for such kinds of recursive functions?
Thanks in advance.