NNVM / Relay compiler doesn't support tensors. Crashes with "AttributeError: 'Tensor' object has no attribute 'node'"


#1

I was trying to use NNVM compiler for a toy TF program, but could not get it compiled, because the model was just a tensor. I have the file attached. It was run on CPU machine running Ubuntu 18, TF version 1.8.0. So I wonder what all does NNVM actually expects as input (as a model from TF). The error remains the same if I replace NNVM with Relay

import numpy as np
import tensorflow as tf
import nnvm
tf.set_random_seed(20180130)
np.random.seed(20180130)

M = 5
N = 2
T = 3
h = 2
s = 3
A_np = np.random.randn(M, h)
C_np = np.random.randn(s, T)

B_np = np.random.randn(h, s)
A_tf = tf.Variable(A_np)
C_tf = tf.Variable(C_np)
B_tf = tf.Variable(B_np)

with tf.Session() as sess:
    sess.run(tf.global_variables_initializer())
    p = tf.matmul(A_tf, B_tf)
    graph, params = nnvm.frontend.from_tensorflow(p)
    graph, lib, params = nnvm.compiler.build(graph, "cpu", {"data", data_shape}, params=params)
    print(sess.run(p))

#2

Maybe you can replace “nnvm” with “relay”


#3

Relay exactly crashes with same error as NNVM :frowning: