Skip to content

prepare function ignoring device, always using GPU #330

@nnmm

Description

@nnmm

Describe the bug

onnx_tf allocates a lot of memory on the GPU (two GPUs, actually) in the prepare function despite the device='CPU' parameter being present. This leads to out of memory crashes. It is also very slow.

To Reproduce
Download resnet50 from the model zoo and unpack into /tmp.

import onnx
from onnx_tf.backend import prepare
onnx_model = onnx.load('/tmp/resnet50/model.onnx')
prepare(onnx_model, device='CPU')

The primary GPU now has memory usage of 7705MiB and the secondary of 4573MiB.

Python, ONNX, ONNX-TF, Tensorflow version

This section can be obtained by running get_version.py from util folder.

  • Python version: 3.5.2
  • ONNX version: 1.3.0
  • ONNX-TF version: 1.2.0
  • Tensorflow version: 1.8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions