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

from_generator method #2

Open
dfalbel opened this issue Dec 3, 2017 · 2 comments
Open

from_generator method #2

dfalbel opened this issue Dec 3, 2017 · 2 comments

Comments

@dfalbel
Copy link
Member

dfalbel commented Dec 3, 2017

I wonder if it's possible to implement the from_generator method. I was trying to implement similar to what's in keras, but got a C stack usage error. Here's the minimal example:

library(tensorflow)
library(tfdatasets)

gen <- function() {
  i <- 0
  function() {
    i <<- i + 1
    i
  }
}

gen2 <- function() reticulate::py_iterator(gen())

dataset <- tf$data$Dataset$from_generator(generator = gen2, output_types =  tuple(tf$float64))
iterator <- dataset$make_one_shot_iterator()
the_next <- iterator$get_next()

sess <- tf$Session()
the_next[[1]]$eval(session = sess) 
@jjallaire
Copy link
Member

Hmmm...not sure why this would be, perhaps something to do with threading. I'll polk at it and see if any solutions appear.

@zyaar
Copy link

zyaar commented Nov 21, 2018

Was there any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants