profile
viewpoint
Jiri Simsa jsimsa Google, Inc. California, USA

feihugis/tensorflow 0

Computation using data flow graphs for scalable machine learning

jsimsa/alluxio 0

Memory-Centric Virtual Distributed Storage System

jsimsa/community 0

Stores documents used by the TensorFlow developer community

jsimsa/doomtrooper 0

Scraper and data for Czech Doomtrooper

jsimsa/flink 0

Mirror of Apache Flink

jsimsa/incubator-zeppelin 0

Mirror of Apache Zeppelin (Incubating)

jsimsa/mesos 0

Mirror of Apache Mesos

jsimsa/spark 0

Mirror of Apache Spark

jsimsa/tensorflow 0

Computation using data flow graphs for scalable machine learning

jsimsa/thrift 0

Mirror of Apache Thrift

issue commenttensorflow/tensorflow

reshuffle_each_iteration=False ignored on validation (tf.dataset + Keras)

reshuffle_each_iteration does not control whether to shuffle each iteration or not. It controls whether different order of shuffling should be used.

If your input pipeline contains shuffle, then each epoch will perform shuffling. If you wish to overlap filling up of shuffle buffer with computation, you should put repeat after shuffle. This will result in the filling up of the shuffle buffer needed for the 2nd epoch to be amortized over the 1st epoch (as opposed to happening at the beginning of each epoch) and so on. You might also want to put prefetch at the end of your input pipeline to overlap training computation with preprocessing computation (see tf.data performance guide for more details).

Kerybas

comment created time in 2 days

pull request commenttensorflow/tensorflow

exclude_col parameter in CSVDataset.

@rachellim could you please review? thanks

stjohnso98

comment created time in 2 days

issue commenttensorflow/tensorflow

Very slow recording of TFRecordWriter with tf.data.Dataset.shard()

The official documentation:

"Generally it is best if the shard operator is used early in the dataset pipeline. For example, when reading from a set of TFRecord files, shard before converting the dataset to input samples. ..."

This is because shard will evaluate the entire upstream input pipeline filtering out (num_shards - 1) / num_shards of the data. In your example, you are running the input pipeline inside of a for loop, which means that you will preprocess the entire input pipeline num_shards many times.

You could use window instead of shard to divide up the dataset into chunks and save each chunk separately along the following lines:

dataset = ...
dataset = dataset.window(ELEMENTS_PER_FILE)
dataset = dataset.enumerate()

def write_data(i, dataset):
  out_path = os.path.join(output_folder, f'{folder}{i+1}.tfrecord')
  dump_dataset(dataset, out_path)
  return out_path

dataset = dataset.map(write_dataset, num_parallel_calls=tf.data.experimental.AUTOTUNE)

If you get rid of using from_generator in your dump_dataset method, you would be able to do the writing in parallel as well (which is additional inefficiency of your program -- writing a unnecessarily serialized on Python GIL).

theonekeyg

comment created time in 5 days

issue commenttensorflow/tensorflow

Loding dataset with TFRecord throws incompatible with the layer

@tomerk can you please take a look? thanks

ll01

comment created time in 5 days

issue closedtensorflow/tensorflow

TextLineDataset could be more expressive

TextLineDataset could be more expressive. For instance, it could have more arguments like:

train_dataset = tf.data.TextLineDataset(
                                     file_path, # dataset file path
                                     format, # file format: jsonl, csv, etc.
                                     fields # a set of colums
)

It would also be incredible if there was a way to indicate how to tokenize each of the fields.

closed time in 6 days

Ceceu

issue commenttensorflow/tensorflow

TextLineDataset could be more expressive

TextLineDataset is for reading text lines. For different types of format, there are dedicated tf.data sources, such as tf.data.experimental.CsvDataset or JsonIODataset from the tensorflow/io repository.

Ceceu

comment created time in 6 days

issue commenttensorflow/tensorflow

Dataset iterating different behavior in TF 2.1 and 2.2

@tomerk could you please take a look? this looks to be rooted in Keras and not tf.data.

sondracek

comment created time in 6 days

issue commenttensorflow/tensorflow

Extension of the Data API `take` method to accept percent values

Thanks. If you do not care about selecting the first 20% but any 20% (approximately), then you can do so by filter:

import tensorflow as tf

dataset = tf.data.Dataset.range(50)
dataset = dataset.filter(lambda _: tf.less(tf.random.uniform(shape=[], maxval=100, dtype=tf.int32, seed=12), 20))

# Iterating through the dataset multiple times will print the same elements 
# because we use a fixed seed for the random uniform call.
for elem in dataset:
  print(elem)

for elem in dataset:
  print(elem) 
milost

comment created time in 7 days

IssuesEvent

issue closedtensorflow/tensorflow

TFRecordDataset mapped with crop is heavily impacted by image sizes

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10, Ubuntu 18.04, Colab
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
  • TensorFlow installed from (source or binary): Binary
  • TensorFlow version (use command below): 2.2
  • Python version: 3.7.7, 3.6.9
  • Bazel version (if compiling from source):
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version: 10.1
  • GPU model and memory: Colab's GPU, V100 32GB, CPU

Describe the current behavior When loading a dataset with large images, and mapping it to random crop, iterating over the dataset is significantly slower, even for a small dataset of 10 images in repeat. In my example I compare a dataset of 10 240x240x3 images, to one with ten 2400x2400x3 images, both of them randomly cropped to 120x120x3 - the latter was about 100 times slower to operate on (reduce_sum, in my toy example).

Describe the expected behavior I would expect there to be no effect from the size of the images in the dataset if they are being cropped right after being loaded once the dataset resides in memory.

Standalone code to reproduce the issue https://colab.research.google.com/drive/1uGeLJJp2gPvgC37WxbP_yANAXB8D83ld#scrollTo=DddLV9gxm5eL

closed time in 7 days

feature-engineer

issue commenttensorflow/tensorflow

TFRecordDataset mapped with crop is heavily impacted by image sizes

You need to run one epoch worth of data to populate the cache before you start timing things.

Get rid of the trailing repeat() and do:

# Warm up caches
for elem in data_from_small:
  pass
for elem in data_from_big:
  pass

start = time.time()
tf.reduce_sum([x for x in data_from_small.repeat().take(1000)])
print(time.time() - start)

start = time.time()
tf.reduce_sum([x for x in data_from_big.repeat().take(1000)])
print(time.time() - start)

I would expect there to be no difference in runtime at that point.

feature-engineer

comment created time in 7 days

Pull request review commenttensorflow/tensorflow

Allow single element padding_values to be broadcasted to a structure for tf.data.Dataset.padded_batch

 def padded_batch(self,     * If the dimension is unknown, the component will be padded out to the       maximum length of all elements in that dimension. +    The `padding_values` argument determines the values used to pad each+    component to the respective shape. The `padding_values` should have the+    same structure as the input dataset. If `padding_values` is a single+    element and the input dataset has multiple components, then the same+    `padding_values` will be used to pad every component of the dataset.+    If `padding_values` is a scalar, then its value will be broadcasted+    to match the shape of each component.

This should be included in the "Args" section of the docstring instead.

yongtang

comment created time in 7 days

issue commenttensorflow/tensorflow

Very slow recording of TFRecordWriter with tf.data.Dataset.shard()

Why not use the method suggested by the official documentation?

theonekeyg

comment created time in 7 days

issue commenttensorflow/tensorflow

TFRecordDataset mapped with crop is heavily impacted by image sizes

repeat re-executes the input pipeline, if you would like to cache the results of previous repeat iterations, you should use the cache transformation.

feature-engineer

comment created time in 8 days

issue commenttensorflow/tensorflow

Why tf data window not using in tutorials/structured_data/time_series

@lamberta this question is related to a tutorial you worked on, could you please take a look? thank you

jimmy6

comment created time in 11 days

issue commenttensorflow/tensorflow

"shuffle_and_repeat_fusion" optimizer content incorrect on s390x arch (big-endian)

adding @gharibian as he is more familiar with TensorFlow strings

rposts

comment created time in 13 days

issue commenttensorflow/tensorflow

Breakpoints do not stop inside tf.function

Reassigning to @jaingaurav for triage as this is not specific to tf.data.

edurenye

comment created time in 14 days

issue commenttensorflow/tensorflow

Breakpoints do not stop inside tf.data.Dataset map function

@edurenye can you check whether you can set a breakpoint within tf.function? tf.data wraps all user defined functions in tf.function and I suspect that the behavior you have observed is not specific to tf.data and applies generally to all tf.functions.

edurenye

comment created time in 15 days

issue commenttensorflow/tensorflow

Extension of the Data API `take` method to accept percent values

The challenge with supporting percentage is that it is not clear what the right behavior is for a dataset whose cardinality is not statically known (or infinite). What would you expect in those cases?

On a related note, could your use case be addressed by taking any 20% of the dataset (as opposed to the initial 20%)? If so, you could achieve that by using filter.

milost

comment created time in 15 days

issue commenttensorflow/tensorflow

"shuffle_and_repeat_fusion" optimizer content incorrect on s390x arch (big-endian)

Here is the method that computes which static optimizations to use. In particular, shuffle_and_repeat_fusion is treated identically to noop_elimination and map_and_batch_fusion, which makes me think that this is not related to shuffle_and_repeat_fusion but to the "last" optimization. To double check that, try reordering the optimizations_to_disable list and see if the problem still occurs for shuffle_and_repeat_fusion.

rposts

comment created time in 15 days

issue commenttensorflow/tensorflow

Using tf.data.Dataset has big overhead

I would also add that instead of having to explicitly take care of prefetching to device yourself through an experimental API, the recommended alternative is to use the tf.distribute API, which would takes care of prefetching to the device.

Flamefire

comment created time in 15 days

issue commenttensorflow/tensorflow

tf.data.experimental.make_csv_dataset modifies mutable variables passed to it

@rachellim could you please take a look? thanks

grofte

comment created time in 21 days

issue commenttensorflow/tensorflow

Ability to exclude columns from tf.data.experimental.CsvDataset

This sounds useful. Marking as "contributions welcome".

omatai

comment created time in 22 days

issue commenttensorflow/tensorflow

Cannot make padded batches from dataset made from ragged tensor slices

Padded batching of ragged tensors is currently not supported (and this is indicated by the error message you get).

@edloper is there a better option for padded batching of RaggedTensors than converting them DenseTensors?

javidcf

comment created time in 22 days

issue closedtensorflow/tensorflow

If tf.data.Dataset.list_files shuffles files, a subsequent take is ignored

<em>Please make sure that this is a bug. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:bug_template</em>

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): yes
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 18.04
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
  • TensorFlow installed from (source or binary): binary (pip install tensorflow)
  • TensorFlow version (use command below): 2.1.0
  • Python version: 2.7
  • Bazel version (if compiling from source):
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version: CUDA 10.1, cuDNN 7.6.5 (the bug happens even with tf.device('/cpu')
  • GPU model and memory: Quadro M1200, 4096MB

You can collect some of this information using our environment capture script You can also obtain the TensorFlow version with:

  1. TF 1.0: python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"
  2. TF 2.0: python -c "import tensorflow as tf; print(tf.version.GIT_VERSION, tf.version.VERSION)"

Describe the current behavior There are 100 TFRecord examples stored on disk, sharded over multiple files. I first do tf.data.Dataset.list_files, then an interleaved map, mapping the dataset to a TFRecordDataset. Then I do a map, with a mapper that parses each serialized example. Then a take to keep 17 elements, then and a repeat (forever).

I iterate over the (infinite) dataset for 400 iterations, keeping track of the number of unique elements seen. If I set shuffle=False in the call to list_files, I see only 17 unique elements. If I set shuffle=True, I see all 100 unique elements, which is wrong.

Describe the expected behavior I expect to only see 17 unique elements, regardless of whether or not I pass shuffle=True or shuffle=False.

Standalone code to reproduce the issue Provide a reproducible test case that is the bare minimum necessary to generate the problem. If possible, please share a link to Colab/Jupyter/any notebook. Please download the attached file (called reproduce_bug.txt because GitHub doesn't like it if I attach .py files). Rename it to reproduce_bug.py and run with python reproduce_bug.py. The file has many comments that further illustrate the bug. reproduce_bug.txt

Other info / logs Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.

closed time in 22 days

aravinho

issue commenttensorflow/tensorflow

If tf.data.Dataset.list_files shuffles files, a subsequent take is ignored

This is working as expected. repeat will re-execute the upstream computation for every repetition. In the case shuffle=True different order of shuffling will be used (since the reshuffle_each_iteration argument of shuffle defaults to True).

Since the reshuffle_each_iteration argument of shuffle is not exposed via list_files, you can either: a) replace the use of list_files(pattern, shuffle=True) with from_tensor_slices(globbed_pattern).shuffle(num_files, reshuffle_each_iteration=False) or b) are cache() after your take transformation.

aravinho

comment created time in 22 days

issue commenttensorflow/tensorflow

Dataset.unbatch() sets cardinality to -2 even when batch size is known

@aaudiber please review the PR from Yong.

min050820

comment created time in 23 days

issue commenttensorflow/tensorflow

Problem with read and get batch from 2d array tfrecords dataset

@aaudiber can you please take a look? thanks

kaen2891

comment created time in 24 days

issue commenttensorflow/tensorflow

Buggy behaviour of dataset API

@aaudiber could you please take a look? thanks

csxeba

comment created time in a month

issue commenttensorflow/tensorflow

Depthwise convolution inside Dataset API throws data_format error

tf-nightly should indeed not have this issue. @chayka could you give it a try? thanks

Talmaj

comment created time in a month

pull request commenttensorflow/tensorflow

[BugFix] - Prefetching on GPU is actually executed on CPU

FYI, this got rolled back automatically because of internal test failures. I will take a look, time permitting. Please ping me if you do not see a response in a week.

DEKHTIARJonathan

comment created time in a month

Pull request review commenttensorflow/tensorflow

Support Keras grouped convolutions

 class Conv(Layer):       the dilation rate to use for dilated convolution.       Currently, specifying any `dilation_rate` value != 1 is       incompatible with specifying any `strides` value != 1.+    groups: Integer, the number of channel groups controlling the connections+      between inputs and outputs. Input channels and `filters` must both be+      divisible by `groups`. For example,

You need to rephrase this.

lgeiger

comment created time in a month

Pull request review commenttensorflow/tensorflow

Support Keras grouped convolutions

 class Conv(Layer):       the dilation rate to use for dilated convolution.       Currently, specifying any `dilation_rate` value != 1 is       incompatible with specifying any `strides` value != 1.+    groups: Integer, the number of channel groups controlling the connections+      between inputs and outputs. Input channels and `filters` must both be+      divisible by `groups`. For example,+        - At `groups=1`, all inputs are convolved to all outputs.+        - At `groups=2`, the operation becomes equivalent to having two+          convolutional layers side by side, each seeing half the input+          channels, and producing half the output channels, and both+          subsequently concatenated.+        - At `groups=input_channels`, each input channel is convolved with its+          own set of filters, of size `input_channels / filters`

should this say filters / input_channels?

lgeiger

comment created time in a month

issue commenttensorflow/tensorflow

Tensorflow Datasets with string inputs do not preserve data type

As per @ymodak's response, this is not a specific to tf.data functionality but behavior of numpy() method:

import numpy as np
import tensorflow as tf

x = tf.constant("hello")
print(x)
print(type(x.numpy()))

Please assign to someone on the TF core team for triage.

desertnaut

comment created time in a month

issue commenttensorflow/tensorflow

Gradient not registered in autograph mode with tf.data.Dataset loop

The intended use for tf.data is to perform the (non-trainable) ETL for data used by your ML workload.

AdrienCorenflos

comment created time in a month

issue closedtensorflow/tensorflow

Gradient not registered in autograph mode with tf.data.Dataset loop

<em>Please make sure that this is a bug. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:bug_template</em>

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): True
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10
  • TensorFlow installed from (source or binary): PIP
  • TensorFlow version (use command below): v2.1.0-rc2-17-ge5bf8de410 2.1.0

Describe the current behavior In autograph mode, gradient is not registered properly (propagates None) if function value depends on dataset values

Describe the expected behavior Gradient in autograph should match gradient in eager mode

Standalone code to reproduce the issue

import tensorflow as tf

dataset = tf.data.Dataset.from_tensor_slices([2., 3.])

def fun(x):
    for data in dataset:
        x = x * data
    return x

decorated_fun = tf.function(fun)

a = tf.constant(1.)
with tf.GradientTape(persistent=True) as tape:
    tape.watch(a)
    b = fun(a)
    c = decorated_fun(a)
print(tape.gradient(b, a)) # prints 6. as expected
print(tape.gradient(c, a)) # prints None

closed time in a month

AdrienCorenflos

issue commenttensorflow/tensorflow

Gradient not registered in autograph mode with tf.data.Dataset loop

tf.data does not support gradients.

AdrienCorenflos

comment created time in a month

pull request commenttensorflow/tensorflow

[BugFix] - Prefetching on GPU is actually executed on CPU

@jsimsa I did not modify these lines https://github.com/tensorflow/tensorflow/blob/0f26cfa90c2477392da1b1409f690c70cdf050f7/tensorflow/python/data/ops/dataset_ops.py#L2275-L2287

And honestly I'm not sure how to fix them, if I apply the suggested fix, i'll get indent errors.

The line numbers are wrong (not sure why) but the indent issues exists. You could have just carefully review the PR diff. To make it easier for you, I commented on the lines that have the wrong indent in your PR.

DEKHTIARJonathan

comment created time in a month

Pull request review commenttensorflow/tensorflow

[BugFix] - Prefetching on GPU is actually executed on CPU

 def _make_initializable_iterator(self, shared_name=None):  # pylint: disable=mis     dataset = self._apply_options()     if shared_name is None:       shared_name = ""-    iterator_resource = gen_dataset_ops.iterator_v2(++    with ops.device(self._variant_tensor.device):+      iterator_resource = gen_dataset_ops.iterator_v2(         container="", shared_name=shared_name, **self._flat_structure)-    with ops.colocate_with(iterator_resource):+       initializer = gen_dataset_ops.make_iterator(           dataset._variant_tensor,  # pylint: disable=protected-access           iterator_resource)-    # pylint: disable=protected-access-    return iterator_ops.Iterator(++      # pylint: disable=protected-access+      return iterator_ops.Iterator(         iterator_resource, initializer, get_legacy_output_types(dataset),         get_legacy_output_shapes(dataset), get_legacy_output_classes(dataset))

wrong indent here

DEKHTIARJonathan

comment created time in a month

Pull request review commenttensorflow/tensorflow

[BugFix] - Prefetching on GPU is actually executed on CPU

 def _make_initializable_iterator(self, shared_name=None):  # pylint: disable=mis     dataset = self._apply_options()     if shared_name is None:       shared_name = ""-    iterator_resource = gen_dataset_ops.iterator_v2(++    with ops.device(self._variant_tensor.device):+      iterator_resource = gen_dataset_ops.iterator_v2(         container="", shared_name=shared_name, **self._flat_structure)-    with ops.colocate_with(iterator_resource):+       initializer = gen_dataset_ops.make_iterator(           dataset._variant_tensor,  # pylint: disable=protected-access           iterator_resource)-    # pylint: disable=protected-access-    return iterator_ops.Iterator(++      # pylint: disable=protected-access+      return iterator_ops.Iterator(         iterator_resource, initializer, get_legacy_output_types(dataset),

wrong indent here

DEKHTIARJonathan

comment created time in a month

Pull request review commenttensorflow/tensorflow

[BugFix] - Prefetching on GPU is actually executed on CPU

 def _make_initializable_iterator(self, shared_name=None):  # pylint: disable=mis     dataset = self._apply_options()     if shared_name is None:       shared_name = ""-    iterator_resource = gen_dataset_ops.iterator_v2(++    with ops.device(self._variant_tensor.device):+      iterator_resource = gen_dataset_ops.iterator_v2(         container="", shared_name=shared_name, **self._flat_structure)

wrong indent here

DEKHTIARJonathan

comment created time in a month

pull request commenttensorflow/tensorflow

[BugFix] - Prefetching on GPU is actually executed on CPU

There is still a couple of lint issues:

FAIL: Found 3 non-whitelisted pylint errors:
tensorflow/python/data/ops/dataset_ops.py:2277: [C0330(bad-continuation), ] Wrong hanging indentation (add 2 spaces).

tensorflow/python/data/ops/dataset_ops.py:2285: [C0330(bad-continuation), ] Wrong hanging indentation (add 2 spaces).

tensorflow/python/data/ops/dataset_ops.py:2286: [C0330(bad-continuation), ] Wrong hanging indentation (add 2 spaces).

AFAICT, the windows failures are unrelated.

DEKHTIARJonathan

comment created time in a month

Pull request review commenttensorflow/tensorflow

[BugFix] - Prefetching on GPU is actually executed on CPU

 def get_next(self, name=None):     if self._get_next_call_count > GET_NEXT_CALL_WARNING_THRESHOLD:       warnings.warn(GET_NEXT_CALL_WARNING_MESSAGE) -    # pylint: disable=protected-access-    flat_ret = gen_dataset_ops.iterator_get_next(+    with ops.device(self._iterator_resource.device):+      # pylint: disable=protected-access+      flat_ret = gen_dataset_ops.iterator_get_next(         self._iterator_resource,

You can't find all the lint warnings in https://source.cloud.google.com/results/invocations/eae2a68e-6a74-41aa-8e87-dfd6855e6249/log

DEKHTIARJonathan

comment created time in a month

Pull request review commenttensorflow/tensorflow

[BugFix] - Prefetching on GPU is actually executed on CPU

 def get_next(self, name=None):     if self._get_next_call_count > GET_NEXT_CALL_WARNING_THRESHOLD:       warnings.warn(GET_NEXT_CALL_WARNING_MESSAGE) -    # pylint: disable=protected-access-    flat_ret = gen_dataset_ops.iterator_get_next(+    with ops.device(self._iterator_resource.device):+      # pylint: disable=protected-access+      flat_ret = gen_dataset_ops.iterator_get_next(         self._iterator_resource,

these used to be indented by 4 spaces from the previous line before your change and now seem to be indented by 2 spaces

DEKHTIARJonathan

comment created time in a month

Pull request review commenttensorflow/tensorflow

[BugFix] - Prefetching on GPU is actually executed on CPU

 def get_next(self, name=None):     if self._get_next_call_count > GET_NEXT_CALL_WARNING_THRESHOLD:       warnings.warn(GET_NEXT_CALL_WARNING_MESSAGE) -    # pylint: disable=protected-access-    flat_ret = gen_dataset_ops.iterator_get_next(+    with ops.device(self._iterator_resource.device):+      # pylint: disable=protected-access+      flat_ret = gen_dataset_ops.iterator_get_next(         self._iterator_resource,

you will need to fix the indent here

DEKHTIARJonathan

comment created time in a month

pull request commenttensorflow/tensorflow

[BugFix] - Prefetching on GPU is actually executed on CPU

The reason you should use _iterator_resource instead of _device is because there are two different implementations of tf.data.Iterator -- one for eager mode + tf.function and one for graph mode. Only the former has the _device property, while both of them have the _iterator_resource property.

DEKHTIARJonathan

comment created time in a month

Pull request review commenttensorflow/tensorflow

Add step argument to SummaryWriter.(set_)as_default.

 class SummaryWriter(object):   """Interface representing a stateful summary writer object."""    @abc.abstractmethod-  def set_as_default(self):-    """Enables this summary writer for the current thread."""+  def set_as_default(self, step=None):+    """Enables this summary writer for the current thread.++    For the `step` argument, see `tf.summary.experimental.set_step()`.++    Args:+      step: An `int64`-castable default step value, or `None`.+        When not `None`, the current step is modified to the given value.+        When `None`, the current step is not modified.+    """     raise NotImplementedError()    @abc.abstractmethod   @tf_contextlib.contextmanager-  def as_default(self):-    """Returns a context manager that enables summary writing."""+  def as_default(self, step=None):+    """Returns a context manager that enables summary writing.++    For the `step` argument, see `tf.summary.experimental.set_step()`.

@nfelt could you advise @foxik on how to add tests? Not having test coverage for public API is undesirable.

foxik

comment created time in a month

pull request commenttensorflow/tensorflow

Fixed _save_model not working for batches in ModelCheckpoint Callback

(for tensorflow/api-owners)

Deferring to @rchao to review the behavior change.

ashutosh1919

comment created time in a month

Pull request review commenttensorflow/tensorflow

Support Keras grouped convolutions

 class Conv(Layer):       the dilation rate to use for dilated convolution.       Currently, specifying any `dilation_rate` value != 1 is       incompatible with specifying any `strides` value != 1.+    groups: Integer, the number of channel groups controlling the connections+      between inputs and outputs. Input channels and `filters` must both be+      divisible by `groups`. For example,

(for tensorflow/api-owners)

The following seems to be copy pasted from PyTorch documentation and should be rephrased.

lgeiger

comment created time in a month

Pull request review commenttensorflow/tensorflow

Add step argument to SummaryWriter.(set_)as_default.

 class SummaryWriter(object):   """Interface representing a stateful summary writer object."""    @abc.abstractmethod-  def set_as_default(self):-    """Enables this summary writer for the current thread."""+  def set_as_default(self, step=None):+    """Enables this summary writer for the current thread.++    For the `step` argument, see `tf.summary.experimental.set_step()`.++    Args:+      step: An `int64`-castable default step value, or `None`.+        When not `None`, the current step is modified to the given value.+        When `None`, the current step is not modified.+    """     raise NotImplementedError()    @abc.abstractmethod   @tf_contextlib.contextmanager-  def as_default(self):-    """Returns a context manager that enables summary writing."""+  def as_default(self, step=None):+    """Returns a context manager that enables summary writing.++    For the `step` argument, see `tf.summary.experimental.set_step()`.++    Args:+      step: An `int64`-castable default step value, or `None`.+        When not `None`, the current step is captured, replaced by a given one,+        and the original one is restored when the context manager exists.

@foxik thank you for the changes, please also add tests for this functionality

foxik

comment created time in a month

pull request commenttensorflow/tensorflow

[r2.2:Cherrypick][tf.data] This CL changes how the in-memory cache resource is managed, making it possible for the cache dataset to support both a) sharing of the cache across iterators and b) serialization. As a consequence, this CL enables sharing of the cache across iterators for tf.distribute and tf.data service use cases (which require serialization support).

Thank you @geetachavan1. Do you plan to cherrypick the other cache CL I pointed out on the internal bug separately? I am not sure whether it is easier to do it separately or in one PR but we need both CLs to be cherrypicked.

geetachavan1

comment created time in a month

issue commenttensorflow/tensorflow

Parallel Write TFRecords Shards

The tf.data team has a plan for making it possible to read and write sharded TFRecord files in parallel. The first step in that direction is the tf.data snapshot proposal https://github.com/tensorflow/community/pull/193/files, which does this under the hoods when generating the snapshot. This is expected to be available in TF 2.3. As a follow up, we plan to expose API to save and load the snapshot (supporting TFRecord as the serialization format).

As a side note, my suggestion would be not to mix multiprocessing.Process with tf.data code. tf.data code is multi-threaded and mixing multi-processing with multi-threading is not safe (because only the calling thread in a forked process is copied to the new process).

rodyt

comment created time in a month

issue commenttensorflow/tensorflow

Support setting shapes directly in tf.py_function

Re-assigning to @rohan100jain for triage.

VitaliKaiser

comment created time in a month

pull request commenttensorflow/datasets

Disable dataset threading by default

Thanks, this PR makes a lot of sense.

lgeiger

comment created time in a month

PR opened tensorflow/community

Reviewers
Update CHARTER.md
+1 -1

0 comment

1 changed file

pr created time in a month

push eventjsimsa/community

Jiri Simsa

commit sha 817eb7246fbea39079b46cfcc940017ccfdb09ce

Update CHARTER.md

view details

push time in a month

issue commenttensorflow/tensorflow

tf.data.experimental.ignore_errors: failed assertions are not logged

Logging the error makes sense. I would be happy to review a contribution that adds an option log_warning option for ignore_errors that controls whether the error is logged.

Andreas5739738

comment created time in a month

issue commenttensorflow/tensorflow

tf.data.Dataset.map() uses only 1 cpu

tf.data indeed uses multi-threading as it is has lower overhead compared to multi-processing.

netw0rkf10w

comment created time in a month

issue commenttensorflow/tensorflow

How to store tf dataset object to file?

The answer from @ashutosh1919 is the idiomatic solution for storing a dataset in a file.

zzj0402

comment created time in a month

issue commenttensorflow/tensorflow

tf.data.Dataset.map() uses only 1 cpu

tf.data.Dataset.map with num_parallel_calls is known to execute computation in parallel and the instructions provided here are not sufficient to reproduce the issue.

Please provide a minimal example that can be used to reproduce the issue. As a side note, instead of using top, I recommend using sar to measure CPU utilization.

netw0rkf10w

comment created time in a month

pull request commenttensorflow/tensorflow

[BugFix] - Prefetching on GPU is actually executed on CPU

@DEKHTIARJonathan Alex left a comment for you on Thursday that (AFAICT) you have not addressed:

The Tensor.device attribute is present in tf2 graph mode. Or are we not getting the device of a tensor? Can you print the object which doesn't have the device attribute on a failure and paste the result here or in a gist?

DEKHTIARJonathan

comment created time in a month

Pull request review commenttensorflow/tensorflow

[BugFix] - Prefetching on GPU is actually executed on CPU

 def fn():     self.evaluate(counter_var.initializer)     self.assertEqual(self.evaluate(fn()), 10) +  def assert_dataset_placement(self, host_dataset, host_iterator, host_tensor,+                               device_dataset, device_iterator, device_tensor):++    def assert_host_placement(_obj):+      try:+        self.assertIn("CPU:0", _obj)+      except AssertionError:+        self.assertEqual(_obj, "")++    assert_host_placement(host_dataset._variant_tensor.device)+    assert_host_placement(host_tensor.device)++    self.assertIn("GPU:0", device_dataset._variant_tensor.device)+    self.assertIn("GPU:0", device_tensor.device)++    if not tf2.enabled() or context.executing_eagerly():

This is somewhat worrisome because if the test code cannot access .device that neither will non-test code and since the code you have modified will run in TF2 graph mode, I suspect that this is an issue.

@alextp does it make sense that the .device attribute is no present in TF2 graph mode?

DEKHTIARJonathan

comment created time in 2 months

issue commenttensorflow/tensorflow

tf.data.experimental.ignore_errors: failed assertions are not logged

Can you please describe the use case where you want to use this API and at the same time you do not want to "ignore" the errors?

Andreas5739738

comment created time in 2 months

issue commenttensorflow/tensorflow

tf.data.experimental.ignore_errors: failed assertions are not logged

I think this works as intended. You either want to ignore errors (in which case you use this API) or you don't.

Andreas5739738

comment created time in 2 months

pull request commenttensorflow/tensorflow

Add support for attr classes in Dataset

If you click on Target Log tab you should see this: Screen Shot 2020-04-09 at 9 26 07 AM

AdrienCorenflos

comment created time in 2 months

Pull request review commenttensorflow/tensorflow

[BugFix] - Prefetching on GPU is actually executed on CPU

 def fn():     self.evaluate(counter_var.initializer)     self.assertEqual(self.evaluate(fn()), 10) +  def assert_dataset_placement(self, host_dataset, host_iterator, host_tensor,+                               device_dataset, device_iterator, device_tensor):++    def assert_host_placement(_obj):+      try:+        self.assertIn("CPU:0", _obj)+      except AssertionError:+        self.assertEqual(_obj, "")++    assert_host_placement(host_dataset._variant_tensor.device)+    assert_host_placement(host_tensor.device)++    self.assertIn("GPU:0", device_dataset._variant_tensor.device)+    self.assertIn("GPU:0", device_tensor.device)++    if not tf2.enabled() or context.executing_eagerly():

Why are are we not checking the iterator device placement in TF2 graph mode?

DEKHTIARJonathan

comment created time in 2 months

Pull request review commenttensorflow/tensorflow

[BugFix] - Prefetching on GPU is actually executed on CPU

 def fn():     self.evaluate(counter_var.initializer)     self.assertEqual(self.evaluate(fn()), 10) +  def assert_dataset_placement(self, host_dataset, host_iterator, host_tensor,+                               device_dataset, device_iterator, device_tensor):++    def assert_host_placement(_obj):+      try:+        self.assertIn("CPU:0", _obj)

You can avoid the try catch by doing:

self.assertTrue("CPU:0" in host_dataset._variant_tensor.device or "" == host_dataset._variant_tensor.device)

DEKHTIARJonathan

comment created time in 2 months

Pull request review commenttensorflow/tensorflow

[BugFix] - Prefetching on GPU is actually executed on CPU

 def fn():     self.evaluate(counter_var.initializer)     self.assertEqual(self.evaluate(fn()), 10) +  def assert_dataset_placement(self, host_dataset, host_iterator, host_tensor,+                               device_dataset, device_iterator, device_tensor):++    def assert_host_placement(_obj):+      try:+        self.assertIn("CPU:0", _obj)+      except AssertionError:+        self.assertEqual(_obj, "")++    assert_host_placement(host_dataset._variant_tensor.device)+    assert_host_placement(host_tensor.device)++    self.assertIn("GPU:0", device_dataset._variant_tensor.device)

pass the device string as an argument to the helper method

DEKHTIARJonathan

comment created time in 2 months

Pull request review commenttensorflow/tensorflow

[BugFix] - Prefetching on GPU is actually executed on CPU

 def testPrefetchToDeviceGpu(self):      self.assertDatasetProduces(device_dataset, list(range(10))) +  @combinations.generate(test_base.default_test_combinations())+  def testPrefetchToDeviceCorrectPlacement(self):++    if not test_util.is_gpu_available():+      self.skipTest("No GPU available")++    host_dataset = dataset_ops.Dataset.range(10)+    device_dataset = host_dataset.apply(+        prefetching_ops.prefetch_to_device("/gpu:0"))++    self.assertTrue((+      "" == host_dataset._variant_tensor.device or+      "CPU:0" in host_dataset._variant_tensor.device+    ))++    self.assertTrue("GPU:0" in device_dataset._variant_tensor.device)

nit: use lower case vs. upper case consistently ("gpu:0" vs. "GPU:0").

DEKHTIARJonathan

comment created time in 2 months

issue commenttensorflow/tensorflow

DatasetVariantWrapper "No unary variant device copy function found"

This is related to https://github.com/tensorflow/tensorflow/issues/34519. Alex made a suggestion there that @saxenasaurabh agree with but I don't think anyone is actively working towards fixing this.

mwalmsley

comment created time in 2 months

pull request commenttensorflow/tensorflow

[BugFix] - Prefetching on GPU is actually executed on CPU

My change has been submitted and you will need to resolve merge conflicts.

On a second thought, I suggest that instead of updating existing unit tests, you write new unit tests that check that the prefetch_with_device and iterator op placement is fixed by your change.

In other words, please add the following tests:

  1. prefetch_to_device_test.py: eager mode and graph mode test that checks that the device of the prefetch dataset variant tensor matches the target device

  2. iterator_test.py:

  • eager mode test that checks that the device of the eagerly created iterator (i.e. iter(dataset) matches the device of the input dataset
  • graph mode test that checks that the device of iterator created by make_one_shot_iterator and make_initializable_iterator matches the device of the input dataset
DEKHTIARJonathan

comment created time in 2 months

pull request commenttensorflow/tensorflow

[BugFix] - Prefetching on GPU is actually executed on CPU

I already created the test internally and will ping this PR when it is submitted.

DEKHTIARJonathan

comment created time in 2 months

pull request commenttensorflow/tensorflow

[BugFix] - Prefetching on GPU is actually executed on CPU

I agree that tf.device is better. I am still not convinced that doing this in Python is better than doing this in placer but assuming the PR addresses my comments below I support the change.

The current version of the PR only fixes the iterator placement issue for TF 1 graph-mode only.

Please extend this PR to also fix the iterator placement issue for TF 2 eager mode and tf.function graph-mode. This will require additional tf.device scopes and I will create a test that will help us validate that your change works in TF 2 eager mode and tf.function graph-mode. Furthermore, this PR should also use the device scope for reduce-based consumption of tf.data elements.

DEKHTIARJonathan

comment created time in 2 months

pull request commenttensorflow/tensorflow

Add support for any Tensor type describable by TensorSpec to tf.data.Dataset.from_generator

@lithuak thank you for the reminder, I didn't have time to take a look as my availability is affected by COVID-19 but I asked @aaudiber to help shepherd this PR

lithuak

comment created time in 2 months

issue commenttensorflow/tensorflow

Memory leak in TensorFlow 2.0 DataSet when using group_by_window.

You should be able to do something along the following lines:

PARALLELISM = 10

filenames = tf.data.Dataset.list_files(path + "/*tfrecord")
indices = tf.data.Dataset.range(PARALLELISM)

def make_dataset(shard_index):
  dataset = filenames.shard(PARALLELISM, index)
  dataset = dataset.flat_map(file_as_batch)
  dataset = dataset.filter(lambda x, *args: tf.shape(x)[0] >= 64)
  return dataset.repeat(100)

dataset = indices.interleave(make_dataset, num_parallel_calls=PARALLELISM)
dataset = dataset.prefetch(buffer_size=tf.data.experimental.AUTOTUNE)

The above will run PARALLELISM copies of the input pipeline, each reading from a different shard of filenames, interleaving the output of these parallel pipelines. Great values of PARALLELISM are expected to speed up your input pipeline (up to the number of available CPU cores) but will also result in high memory usage.

akanyaani

comment created time in 2 months

issue commenttensorflow/tensorflow

Memory leak in TensorFlow 2.0 DataSet when using group_by_window.

The easiest option is to specify num_parallel_reads=None when calling the TFRecordDataset. That way your input pipeline will be processing files in a sequential order instead of interleaving their elements.

akanyaani

comment created time in 2 months

issue closedtensorflow/tensorflow

[tf.data.experimental.cardinality] not working on FlatMapDataset ? [2.2.0-rc1]

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): MacOS 10.14.6
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: No
  • TensorFlow installed from (source or binary): pip
  • TensorFlow version (use command below): v2.2.0-rc0-43-gacf4951a2f 2.2.0-rc1
  • Python version: 3.7.6
  • Bazel version (if compiling from source):
  • GCC/Compiler version (if compiling from source): NA
  • CUDA/cuDNN version: - GPU model and memory: NA

Describe the current behavior I am making some test with 2.2.0-rc1. When using data from tensorflow dataset tf.data.experimental.cardinality is returning the number of even

print(data['train'])
print(tf.data.experimental.cardinality(data['train'])) 
<DatasetV1Adapter shapes: {idx: (), label: (), sentence: ()}, types: {idx: tf.int32, label: tf.int64, sentence: tf.string}>
tf.Tensor(67349, shape=(), dtype=int64)

In such case I have a DatasetV1Adapter

Now when I am using Huggingface transformer that modify the structure of the data:

train_dataset = glue_convert_examples_to_features(data['train'], 
                                                  tokenizer, 
                                                  max_length=128, 
                                                  task='sst-2')
print(tf.data.experimental.cardinality(train_dataset))
<FlatMapDataset shapes: ({input_ids: (None,), attention_mask: (None,), token_type_ids: (None,)}, ()), types: ({input_ids: tf.int32, attention_mask: tf.int32, token_type_ids: tf.int32}, tf.int64)>
tf.Tensor(-2, shape=(), dtype=int64)

In this case this is a FlatMapDataset and tf.data.experimental.cardinality is not able tor eturn the number of event ? Is this expected ? In which case is tf.data.experimental.cardinality working ?

The documentation for TF 2.1.0 just said: dataset: A tf.data.Dataset for which to determine cardinality. https://www.tensorflow.org/api_docs/python/tf/data/experimental/cardinality For me (as a naive user) FlatMapDataset/DatasetV1Adapter are tf.data.Dataset

The way the transformer is modifying the data is by using tf.data.Dataset.from_generator

Describe the expected behavior Be able to return the total number of entry after the data being transformer using tf.data.Dataset.from_generator

Standalone code to reproduce the issue

data, info = tensorflow_datasets.load(name='glue/sst2',
                                      data_dir=data_dir,
                                      with_info=True)
# recap input dataset
print(data['train'])
print(tf.data.experimental.cardinality(data['train']))
print(len(list(data['train']))

# Prepare data for BERT
train_dataset = glue_convert_examples_to_features(data['train'], 
                                                  tokenizer, 
                                                  max_length=128, 
                                                  task='sst-2')

print(train_dataset)
print(tf.data.experimental.cardinality(train_dataset))
print(len(list(train_dataset)))

A full notebook can be found here: https://github.com/tarrade/proj_multilingual_text_classification/blob/master/notebook/00-Test/08_SST2_Huggingface_model.ipynb

Other info / logs Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.

closed time in 2 months

tarrade

issue commenttensorflow/tensorflow

[tf.data.experimental.cardinality] not working on FlatMapDataset ? [2.2.0-rc1]

The answer is most likely that the glue_convert_examples_to_features method (for which I do not see source code) is doing something that prevents tf.data.experimental.cardinality from statically inferring the size of the output dataset.

Like shape inference, tf.data.experimental.cardinality will only produce a known answer if the answer can be determined by static analysis (i.e. without executing the input pipeline). When the input pipeline contains a flat_map, it is generally not possible to statically determine what will be the cardinality of the output from the cardinality from the input; for instance, the inputs to flat_map could be filenames that flat_map uses to create TFRecordDataset (that do not have statically known cardinality).

If you know the relationship between the input and output cardinality of your flat_map, you can provide it to the runtime using tf.data.experimental.assert_cardinality.

tarrade

comment created time in 2 months

issue commenttensorflow/tensorflow

Memory leak in TensorFlow 2.0 DataSet when using group_by_window.

This is not a memory leak and is working as intended. group_by_window will maintain up to num_keys * window_size elements buffered in memory. If you have too many keys or too many windows, you will use a lot of memory.

IIUC, your program is effectively trying to do an in-memory sort using the query ID as the key. If your dataset does not fit into memory this will not be possible.

What is not clear to me is why do you need to use group_by_window in the first place, if your individual TFRecord files are already grouped by query ID. Is it perhaps because your make_dataset method is interleaving entries from different files? If so, I suggest changing that part of your input pipeline.

akanyaani

comment created time in 2 months

issue commenttensorflow/tensorflow

Error while reading resource variable _AnonymousVar12 from Container: localhost

You need to put the variable outside of the user-defined function:

import tensorflow as tf

ds=tf.data.Dataset.from_tensor_slices(tf.constant([[9, 10, 11, 12]]))
ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8])
def update(update):
    indices = tf.constant([[4], [3], [1] ,[7]])
    updated = tf.tensor_scatter_nd_update(ref, indices, update)
    return updated
ds=ds.map(update)
for i in ds:
    print(i)

In your example, the Python object for the variable is destroyed when the tracing of the function completes, which results in the use-after-free error in your program.

mindis

comment created time in 2 months

issue commenttensorflow/tensorflow

tf dataset cache behave differently with filter for TF 1.x

In TF 1, memory-based cache only support reuse through subsequent repeat. This is because the implementation uses an in-memory cache that is owned by the iterator and thus different iterators will have different caches. This is not an issue for file-based caches because different iterators can access the same file-based cache.

This is fixed in TF 2 where a single in-memory cache is shared among all iterators created for a dataset.

hardianlawi

comment created time in 2 months

Pull request review commenttensorflow/tensorflow

Added example and description about numpy_function() in Dataset.map()

 def map(self, map_func, num_parallel_calls=None, deterministic=None):     >>> list(d.as_numpy_iterator())     [b'HELLO', b'WORLD'] +    3) Use `tf.numpy_function`, which also allows you to write arbitrary+    Python code. Note here that `tf.py_function` accepts `tf.Tensor` whereas+    `tf.numpy_function` accepts numpy arrays and returns only numpy arrays.+    For example:++    >>> d = tf.data.Dataset.from_tensor_slices(['hello', 'world'])+    >>> def upper_case_fn(t: np.ndarray):+    ...   return t.decode('utf-8').upper()+    >>> d = d.map(lambda x: tf.numpy_function(func=upper_case_fn,+    ...           inp=[x], Tout=tf.string))+    >>> list(d.as_numpy_iterator())+    [b'HELLO', b'WORLD']++    Note the fact that the use of `tf.numpy_function` and `tf.py_function`

thank you, please remove "the fact" ... so this should start with "Note that the use of ..."

ashutosh1919

comment created time in 2 months

CommitCommentEvent

issue closedtensorflow/tensorflow

tf dataset cache behave differently with filter for TF 1.x

<em>Please make sure that this is a bug. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:bug_template</em>

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 16.04
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: NA
  • TensorFlow installed from (source or binary): binary (pip)
  • TensorFlow version (use command below): v1.15.0-rc3-22-g590d6eef7e 1.15.0
  • Python version: - Bazel version (if compiling from source): NA
  • GCC/Compiler version (if compiling from source): NA
  • CUDA/cuDNN version: - GPU model and memory: NA

You can collect some of this information using our environment capture script You can also obtain the TensorFlow version with: 1. TF 1.0: python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)" 2. TF 2.0: python -c "import tensorflow as tf; print(tf.version.GIT_VERSION, tf.version.VERSION)"

Describe the current behavior

When applying filter before cache on tf.data.Dataset, the outputs when caching to file compared to caching to memory are different.

Describe the expected behavior

They should be the same.

TF 2x is working as expected.

Standalone code to reproduce the issue

Cache to memory

import tensorflow as tf

tf.enable_eager_execution()

data = tf.data.Dataset.from_tensor_slices(list(range(50)))
data = data.filter(lambda x: tf.random.uniform([]) < 0.5)
data = data.cache()

outputs = [x for x in data]
outputs_1 = [x for x in data]

assert len(outputs) == len(outputs_1)

for x, y in zip(outputs, outputs_1):
    assert x.numpy() == y.numpy()

Cache to file

import tensorflow as tf

tf.enable_eager_execution()

data = tf.data.Dataset.from_tensor_slices(list(range(50)))
data = data.filter(lambda x: tf.random.uniform([]) < 0.5)
data = data.cache('/tmp/dummy_data')

outputs = [x for x in data]
outputs_1 = [x for x in data]

assert len(outputs) == len(outputs_1)

for x, y in zip(outputs, outputs_1):
    assert x.numpy() == y.numpy()

Other info / logs Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.

closed time in 2 months

hardianlawi

issue commenttensorflow/tensorflow

tf dataset cache behave differently with filter for TF 1.x

In TF 1, cache does not work with eager iteration (i.e. from elem in dataset). You should either use TF 2 or append repeat to the end of your dataset consume multiple epochs.

hardianlawi

comment created time in 2 months

Pull request review commenttensorflow/tensorflow

Added example and description about numpy_function() in Dataset.map()

 def map(self, map_func, num_parallel_calls=None, deterministic=None):     >>> list(d.as_numpy_iterator())     [b'HELLO', b'WORLD'] +    3) Use `tf.numpy_function`, which also allows you to write arbitrary

Please add information about that fact the the use of tf.numpy_function and tf.py_function in general precludes the possibility executing user-defined transformations in parallel (because of Python GIL).

ashutosh1919

comment created time in 2 months

CommitCommentEvent

issue commenttensorflow/tensorflow

Error occurred when finalizing GeneratorDataset iterator

Good to know. Note that the warning and the memory leak are unrelated.

olk

comment created time in 2 months

issue commenttensorflow/tensorflow

KeyError: 'ParallelInterleaveDataset' in Tf >= 1.13 (mkl/gpu)

Yes, the best know solution is to update the serialized checkpoint, replacing occurrences of ParallelInterleaveDataset with ExperimentalParallelInterleaveDataset.

prateethvnayak

comment created time in 2 months

push eventjsimsa/community

Jiri Simsa

commit sha a6d579823a36db2eed4e627199e7c6f8cfa37f19

Fix typo.

view details

push time in 2 months

Pull request review commenttensorflow/community

Optional arguments with defaults.

 does not give license to new APIs to be bad in the same way. Improvement must be balanced with consistency, however, and sometimes it’s okay to carry small imperfections into new APIs for the sake of consistency with old APIs. +### Optional arguments with default values++Many APIs have optional arguments with a default value. Our recommendation is to+use `None` as the default value of any optional arguments and have the+implementation be responsible for handnling it as opposed to using a default

done

jsimsa

comment created time in 2 months

push eventjsimsa/community

Jiri Simsa

commit sha c5cdd97bacf571ba5b429e07ddbb0225101e8745

Optional arguments with defaults.

view details

push time in 2 months

PR opened tensorflow/community

Optional arguments with defaults.
+10 -0

0 comment

1 changed file

pr created time in 2 months

create barnchjsimsa/community

branch : none

created branch time in 2 months

pull request commenttensorflow/tensorflow

Add support for any Tensor type describable by TensorSpec to tf.data.Dataset.from_generator

@lithuak the change has been rolled back in https://github.com/tensorflow/tensorflow/commit/858bd4506a8b390fc5b2dcbeb3057f4a92e8a1e2 and the new test has been added in https://github.com/tensorflow/tensorflow/commit/0349c8ddf5b185ae102e62b5de2bddbe56773926

You are welcome to go ahead and create a new PR that reapplies the changes and makes sure that the newly added test is passing. Thanks.

lithuak

comment created time in 2 months

pull request commenttensorflow/tensorflow

Add support for any Tensor type describable by TensorSpec to tf.data.Dataset.from_generator

There is another issue with this change, which seems non-trivial to fix and might be affecting backwards compatibility.

An internal user has reported the following error:

Invalid argument: TypeError: `generator` yielded an element that did not match the expected structure. The expected structure was {'prefix': (TensorShape([]), tf.string, None), 'suffix': (TensorShape([]), tf.string, None), 'idx': (TensorShape([]), tf.int64, None), 'idxs': (TensorShape([Dimension(None)]), tf.int64, None), 'id': (TensorShape([]), tf.string, None), 'ids': (TensorShape([Dimension(None)]), tf.string, None)}, but the yielded element was {'idx': 1, 'idxs': (200, 201), 'id': 'b', 'ids': ('b1',), 'prefix': 'that', 'suffix': 'was another validation'}.

I am going to roll this change back again and ask the internal user to contribute a test to tf.data that is representative of their use case.

@lithuak once the test is available, you can go ahead and create a new PR with the original change + whatever fix is needed for the newly discovered breakage. As a side effect, you will get credit for the change the way you like.

lithuak

comment created time in 2 months

pull request commenttensorflow/tensorflow

Add support for any Tensor type describable by TensorSpec to tf.data.Dataset.from_generator

@lithuak can you make some additional change in the PR that would result in non-empty delta? For example add a test or improve documentation of from_generator in some minor way.

lithuak

comment created time in 2 months

issue commenttensorflow/tensorflow

Error occurred when finalizing GeneratorDataset iterator

There was a bug for Keras sequence multi-processing implementation that was fixed in https://github.com/tensorflow/tensorflow/commit/e918c6e6fab5d0005fcde83d57e92b70343d3553. This will be available in TF 2.2 and should be already available in TF nightly.

olk

comment created time in 2 months

pull request commenttensorflow/tensorflow

[TF2.2:Cherrypick]Fixing a memory leak in Keras.

Thank you very much Geeta! I was actually in a middle of creating a cherrypick myself :-)

geetachavan1

comment created time in 2 months

more