Unverified Commit ac7b4205 by Tianqi Chen Committed by GitHub

[TOPI] Fix reduce behavior to be consistent to numpy (#1738)

[TOPI] Fix reduce behavior to be consistent with numpy
parent ce0d5144
......@@ -95,9 +95,6 @@ inline Array<Expr> MakeReduceTargetShape(const std::vector<int>& real_axis,
target_shape.push_back(data->shape[i]);
}
}
if (target_shape.size() == 0) {
target_shape.push_back(1);
}
}
return target_shape;
}
......
......@@ -72,7 +72,6 @@ def verify_reduce_map_ele(in_shape, axis, keepdims, type="sum", dtype="float32")
out_npy = _my_npy_argmin(in_npy_map, axis=axis, keepdims=keepdims)
else:
raise NotImplementedError
out_npy = np.atleast_1d(out_npy)
data_tvm = tvm.nd.array(in_npy, ctx=ctx)
out_tvm = tvm.nd.empty(shape=out_npy.shape, ctx=ctx, dtype=out_dtype)
for _ in range(1):
......
......@@ -77,7 +77,6 @@ def verify_reduce_map_ele(in_shape, axis, keepdims, type="sum"):
out_npy = in_npy_map.prod(axis=axis, keepdims=keepdims)
else:
raise NotImplementedError
out_npy = np.atleast_1d(out_npy)
data_tvm = tvm.nd.array(in_npy, ctx=ctx)
out_tvm = tvm.nd.empty(shape=out_npy.shape, ctx=ctx, dtype=out_dtype)
for _ in range(1):
......
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