Array<IndexExpr> oshape;
for (size_t i = 1; i < kdim + 1; ++i) oshape.push_back(indices->shape[i]);
for (size_t i = mdim->value; i < ndim; ++i) oshape.push_back(data->shape[i]);
- if (oshape.size() == 0) {
- oshape.push_back(tir::make_const(DataType::Int(32), 1));
- }
reporter->Assign(types[2], TensorType(oshape, data->dtype));
return true;
}
CHECK(tt != nullptr);
const auto* param = attrs.as<NdarraySizeAttrs>();
CHECK(param != nullptr);
- reporter->Assign(types[1], TensorType({1}, param->dtype));
+ reporter->Assign(types[1], TensorType({}, param->dtype));
return true;
}
ctx.device_id = 0;
runtime::NDArray value;
DLDataType cdtype = DataType::Int(32);
- value = runtime::NDArray::Empty({1}, cdtype, ctx);
+ value = runtime::NDArray::Empty({}, cdtype, ctx);
int32_t* data = static_cast<int32_t*>(value->data);
if (ishape.size() == 0) {
*data = 0;
def vmobj_to_list(o):
if isinstance(o, tvm.nd.NDArray):
- return [o.asnumpy().tolist()]
+ return [o.asnumpy()]
elif isinstance(o, tvm.runtime.container.ADT):
result = []
for f in o:
# since the names from tensorflow and relay runs are not exactly same,
# first len(tf_output) will be compared
for i in range(len(tf_output)):
+ if not isinstance(tf_output[i], np.ndarray):
+ assert len(tvm_output[i].shape) == 0
tvm.testing.assert_allclose(
tf_output[i], tvm_output[i], atol=1e-5, rtol=1e-5)
def expected(dtype):
x = relay.var("x", shape=c_shape, dtype="float32")
y = relay.var("y", shape=c_shape, dtype="float32")
- z = relay.const([np.size(np.zeros(c_shape))], dtype=dtype)
+ z = relay.const(np.size(np.zeros(c_shape)), dtype=dtype)
func = relay.Function([x, y], z)
return func
for (size_t i = indices_dim0; i < ndim_d; ++i) {
out_shape.push_back(data->shape[i]);
}
- if (out_shape.size() == 0) {
- out_shape.push_back(make_const(DataType::Int(32), 1));
- }
return compute(
out_shape,
[&](const Array<Var>& out_index) {
const std::string& name = "ndarray_size",
const std::string& tag = kInjective) {
int ndim = static_cast<int>(src->shape.size());
- Array<PrimExpr> out_ndarray_size = {1};
+ Array<PrimExpr> out_ndarray_size = {};
return compute(
out_ndarray_size,
[&](const Array<Var>& indices) {
print("Skip because %s is not enabled" % device)
return
tvm_input = tvm.nd.array(input, ctx=ctx)
- tvm_output = tvm.nd.empty((1,), ctx=ctx, dtype=B.dtype)
+ tvm_output = tvm.nd.empty((), ctx=ctx, dtype=B.dtype)
print("Running on target: %s" % device)
with tvm.target.create(device):
s = topi.testing.get_injective_schedule(device)(B)