Skip to content

Extremely slow inference times for CorrelationCost layer on CPU #688

@evancasey

Description

@evancasey

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 16.04
  • TensorFlow version and how it was installed (source or binary): 2.0.0, binary
  • TensorFlow-Addons version and how it was installed (source or binary): 0.6.0, binary
  • Python version: 3.7
  • Is GPU used? (yes/no): no, CPU

Describe the bug

Inference takes about ~40s for the example (described below). On my GPU, this runs in under a second.

For reference, the pytorch correlation sampler seems to have much better performance on CPU.

Code to reproduce the issue

import tensorflow as tf
from tensorflow_addons.layers import CorrelationCost

ccl = CorrelationCost(
       kernel_size=1,
       max_displacement=10,
       stride_1=1,
       stride_2=1,
       pad=0,
       data_format='channels_last')

x = tf.ones([1, 148, 276, 1024])
y = tf.ones([1, 148, 276, 1024])

ccl([x,y])

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions