[frontend][tensorflow2] unknown type resource

Hi,

I has one tf2 model which has node like below:

node { name: “unknown” op: “Placeholder” attr { key: “_output_shapes” value { list { shape { } } } } attr { key: “dtype” value { type: DT_RESOURCE } } attr { key: “shape” value { shape { unknown_rank: true } } } }

while trying do the from_tensorflow to import from gdef to tvm’s relay, TVM report failure as:

0: tvm::runtime::String2DLDataType(std::__cxx11::basic_string<char, std::char_traits, std::allocator >) File “/data/compiler/tvm/include/tvm/runtime/packed_func.h”, line 777 TVMError: In function ir.TensorType(0: Array, 1: DataType) → relay.TensorType: error while converting argument 1: [11:05:21] /data/compiler/tvm/include/tvm/runtime/data_type.h:374: unknown type resource

Does it mean that current tf2 is not fully supported, like the DT_RESOURCE node type? For this kind of model, what we need to do to convert?

Thx

I search about DT_RESOURCE, and finnaly found in Resource Variable Operations in TensorFlow/XLA.

I think a node with DT_RESOURCE type, it feeds could from some memory variable’s.

so could you change the node with name “unknown” type Placeholder with a placeholder with specified dataype and shape.

if the resource node feeds with int32 value and some shape, change the node with it.

The tf model’s saved as pb format for serving purpose, so it is difficult to rewrite its data type…

Could we just add new type handle branch here in data_type.h for this resource? Or we need to add some prepropressing in tf frontend? If so, how to do the conversion?

it’s not just the problem about datatype. the placeholder with unknown rank means dynamic shape, for now the tvm does not support it well. even if you solve this problem, dynamic shape will be a chanllenge.

As I know next generation relay, relax, is going to support the dynamic shape. So for relax branch, has it already solve this tensorflow import issue?..