zhaojinxi commented on PR #13693:
URL: https://github.com/apache/tvm/pull/13693#issuecomment-1371869902
@masahi Try the code below, with the old wrong code, it will print "p0 has
shape: [1, 3, 4, 16]", actually it should print "p0 has shape: [3, 3, 1, 1]"
import tvm
import numpy
from tvm import relay
from tvm.contrib.debugger.debug_executor import GraphModuleDebug
x = relay.var("x", shape=(1, 3, 48, 16), dtype="float32")
t = relay.split(x, [12, 16, 32], 2).astuple()
x0 = relay.TupleGetItem(t, 0)
x1 = relay.TupleGetItem(t, 1)
x2 = relay.TupleGetItem(t, 2)
x3 = relay.TupleGetItem(t, 3)
weight = relay.const(numpy.random.uniform(-1, 1, (3, 3, 1,
1)).astype("float32"))
y = relay.nn.conv2d(x2, weight, kernel_size=(1, 1), kernel_layout="OIHW",
out_dtype="float32") + x3
func = relay.Function([x], relay.Tuple([x0, x1, y]))
mod = tvm.IRModule.from_expr(func)
mod = relay.transform.InferType()(mod)
target = tvm.target.Target("llvm")
device = tvm.cpu()
lib = relay.build(mod, target=target)
m = GraphModuleDebug(lib["debug_create"]("default", device), [device],
lib.get_graph_json(), ".")
nodes = m.debug_datum.get_graph_nodes()
print(nodes[2]['name'],' has shape: ',nodes[2]['shape'])
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]