- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3.7k
Closed
Labels
Description
def manual_test():
    data_shape=(1, 1, 2, 2)
    data_dtype='int32'
    data = relay.var("data", shape=data_shape,
            dtype=data_dtype)
    pool = relay.op.nn.avg_pool2d(data, pool_size=(2, 2))
    func = pool
    func = run_infer_type(func)
    func = relay.Function(relay.analysis.free_vars(func),
                func)
    print(func)
    with relay.build_config(opt_level=0):
        graph, lib, params = relay.build(func, "llvm", params=None)
        mod = graph_runtime.create(graph, lib, ctx=tvm.cpu(0))
        golden_data = np.array([5, 5, 5, 5]).reshape(data_shape).astype(data_dtype)
        mod.set_input("data",golden_data)
        mod.run()
        res = mod.get_output(0).asnumpy()
        print(res)
The above gives output 4 instead of 5.
Setting the golden_data to (1, 1, 1, 1) gives output 0.
I think we are dividing before accumulating. Since, we have only tested on Float32, this never showed up before. But, in int32, it performs int division.