Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap dataset generation function to disable autograph to fix issues with invalid tensor shapes #2069

Merged
merged 1 commit into from Jun 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion horovod/spark/keras/util.py
Expand Up @@ -15,6 +15,8 @@

import io

from distutils.version import LooseVersion

import h5py
import numpy as np
import tensorflow as tf
Expand All @@ -28,6 +30,8 @@
BARE_KERAS = 'keras'
TF_KERAS = 'tf_keras'

_HAS_AUTOGRAPH = LooseVersion(tf.__version__) >= LooseVersion('1.15')


class TFKerasUtil(object):
type = TF_KERAS
Expand Down Expand Up @@ -74,7 +78,7 @@ def fn(reader, shuffle_buffer_size, is_batch_reader, shuffle=False):

dataset = dataset.batch(batch_size).map(prep_data_tf_keras)
return dataset
return fn
return tf.autograph.experimental.do_not_convert(fn) if _HAS_AUTOGRAPH else fn

@staticmethod
def get_horovod():
Expand Down