Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[OpPerf] Fixes the issue when you pass NDArray to run_perf_test #17508

Merged
merged 2 commits into from
Feb 4, 2020
Merged
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
4 changes: 2 additions & 2 deletions benchmark/opperf/utils/ndarray_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ def get_mx_ndarray(ctx, in_tensor, dtype, initializer, attach_grad=True):
tensor = nd.array(in_tensor, ctx=ctx, dtype=dtype)
elif isinstance(in_tensor, np.ndarray):
tensor = nd.array(in_tensor, ctx=ctx, dtype=dtype)
elif isinstance(in_tensor, mx.ndarray):
tensor = in_tensor.as_in_context(ctx=ctx).astype(dtype=dtype)
elif isinstance(in_tensor, nd.NDArray):
tensor = in_tensor.as_in_context(ctx).astype(dtype=dtype)
else:
raise ValueError("Invalid input type for creating input tensor. Input can be tuple() of shape or Numpy Array or"
" MXNet NDArray. Given - ", in_tensor)
Expand Down