# Pb to uff error

**URL:** <https://forums.developer.nvidia.com/t/pb-to-uff-error/119670>\
**Category:** TensorRT\
**Created:** [April 14, 2020, 6:07am UTC](https://forums.developer.nvidia.com/t/pb-to-uff-error/119670 "2020-04-14T06:07:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wangxiang2713](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@wangxiang2713](https://forums.developer.nvidia.com/u/wangxiang2713)\
**Post date:** [April 14, 2020, 6:07am UTC](https://forums.developer.nvidia.com/t/pb-to-uff-error/119670/1 "2020-04-14T06:07:28Z")

</div>

## Description

I tried to convert a pb model to uff, but i got error:

```auto
Traceback (most recent call last):
  File "pb_to_uff.py", line 14, in <module>
    text = True) # If set to True, the converter will also write out a human readable UFF file.
  File "/home/hadoop-hdp/.local/lib/python2.7/site-packages/uff/converters/tensorflow/conversion_helpers.py", line 229, in from_tensorflow_frozen_model
    return from_tensorflow(graphdef, output_nodes, preprocessor, **kwargs)
  File "/home/hadoop-hdp/.local/lib/python2.7/site-packages/uff/converters/tensorflow/conversion_helpers.py", line 178, in from_tensorflow
    debug_mode=debug_mode)
  File "/home/hadoop-hdp/.local/lib/python2.7/site-packages/uff/converters/tensorflow/converter.py", line 94, in convert_tf2uff_graph
    uff_graph, input_replacements, debug_mode=debug_mode)
  File "/home/hadoop-hdp/.local/lib/python2.7/site-packages/uff/converters/tensorflow/converter.py", line 79, in convert_tf2uff_node
    op, name, tf_node, inputs, uff_graph, tf_nodes=tf_nodes, debug_mode=debug_mode)
  File "/home/hadoop-hdp/.local/lib/python2.7/site-packages/uff/converters/tensorflow/converter.py", line 47, in convert_layer
    return cls.registry_[op](name, tf_node, inputs, uff_graph, **kwargs)
  File "/home/hadoop-hdp/.local/lib/python2.7/site-packages/uff/converters/tensorflow/converter_functions.py", line 33, in convert_const
    array = tf2uff.convert_tf2numpy_const_node(tf_node)
  File "/home/hadoop-hdp/.local/lib/python2.7/site-packages/uff/converters/tensorflow/converter.py", line 141, in convert_tf2numpy_const_node
    array = np.frombuffer(data, dtype=np_dtype)
ValueError: cannot create an OBJECT array from memory buffer

```

Any thing wrong?

## Environment

**TensorRT Version: 7.0**  
**GPU Type: T4**  
**Nvidia Driver Version: 410.79**  
**CUDA Version: 10.0**  
**CUDNN Version: 7.6.4**  
**Operating System + Version: Centos 7**  
**Python Version (if applicable): 2.7**  
**TensorFlow Version (if applicable): 1.15**

---

<div class="post-metadata">

**Author:** ![SunilJB](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/suniljb/32/14043_2.png) [@SunilJB](https://forums.developer.nvidia.com/u/SunilJB)\
**Post date:** [April 14, 2020, 7:10am UTC](https://forums.developer.nvidia.com/t/pb-to-uff-error/119670/2 "2020-04-14T07:10:10Z")

</div>

Hi,

It doesn’t seems to be TRT issue, please refer below link:  
[https://docs.scipy.org/doc/numpy/reference/generated/numpy.frombuffer.html](https://docs.scipy.org/doc/numpy/reference/generated/numpy.frombuffer.html)

Also, we are deprecating Caffe Parser and UFF Parser in TensorRT 7. I will recommend you to please use ONNX parser:

> **[Release Notes :: NVIDIA Deep Learning TensorRT Documentation](https://docs.nvidia.com/deeplearning/tensorrt/archives/tensorrt-700/tensorrt-release-notes/tensorrt-7.html)**
>
> NVIDIA TensorRT is a C++ library that facilitates high performance inference on NVIDIA GPUs. It is designed to work in connection with deep learning frameworks that are commonly used for training. TensorRT focuses specifically on running an already...

Thanks

---

<div class="post-metadata">

**Author:** ![wangxiang2713](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@wangxiang2713](https://forums.developer.nvidia.com/u/wangxiang2713)\
**Post date:** [April 14, 2020, 7:48am UTC](https://forums.developer.nvidia.com/t/pb-to-uff-error/119670/3 "2020-04-14T07:48:11Z")

</div>

I tired to convert my pb model to onnx, but the oonx model’s structure is very different from my pb model. So i can only convert to onnx if i want to use trt(not tf-trt) to convert my tensorflow model?

---

<div class="post-metadata">

**Author:** ![SunilJB](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/suniljb/32/14043_2.png) [@SunilJB](https://forums.developer.nvidia.com/u/SunilJB)\
**Post date:** [April 14, 2020, 7:55am UTC](https://forums.developer.nvidia.com/t/pb-to-uff-error/119670/4 "2020-04-14T07:55:05Z")

</div>

If i understood your question correctly. You don’t need to convert to ONNX model if you are planning to use TF-TRT.  
Only in case of TRT model you need to follow below workflow:  
pb → ONNX → TRT

Thanks
