{"QuestionId":49988950,"AnswerCount":0,"Tags":"","CreationDate":"2018-04-23T19:51:05.750","AcceptedAnswerId":null,"OwnerUserId":null,"Title":"LSTM Keras confusion","Body":"

@enumaris thank you for your answer. I'll try to explain my approach a bit: <\/p>\n\n

I pushed the video frames through resnet model and got fature shapes of . I have the data into train\/validation and test folders. Then I was writing this script:<\/p>\n\n

<\/pre>\n\n

Which results in the following error:<\/p>\n\n

\n

ValueError: Error when checking model input: the list of Numpy arrays that you are passing to your model is not the size the model expected. Expected to see 1 array(s), but instead got the following list of 3521 arrays.<\/p>\n<\/blockquote>\n","answers":[]} {"QuestionId":49989406,"AnswerCount":1,"Tags":"","CreationDate":"2018-04-23T20:24:06.393","AcceptedAnswerId":50121740.0,"OwnerUserId":4743714.0,"Title":"Parsing TFRecord when in eager execution","Body":"

Considering that is possible to run<\/a> in eager execution mode, how should I open a TFRecord file on eager execution? I'm more concerned about the parser writing, because I'm currently using as an iterator (between several images on my container).<\/p>\n","answers":[{"AnswerId":"50121740","CreationDate":"2018-05-01T18:23:26.643","ParentId":null,"OwnerUserId":"6708503","Title":null,"Body":"

In TensorFlow 1.8 onwards you can naturally iterate on the tf.data.Dataset<\/code> object with eager execution enabled.<\/p>\n\n

ds = tf.data.TFRecordDataset(...).map(...).batch(...)\nfor x in ds:\n  print(x)\n<\/code><\/pre>\n\n

make_one_shot_iterator<\/code> will also work (kept working to keep compatible with equivalent code for graph construction):<\/p>\n\n

ds = tf.data.TFRecordDataset(...).map(...).batch(...)\nitr = ds.make_one_shot_iterator()\nfor x in itr:\n  print(x)\n<\/code><\/pre>\n\n

However, in older versions of TensorFlow (where eager execution is a newly introduced feature and thus less baked), you'll have to wrap your dataset in a tf.contrib.eager.Iterator<\/code>, using something like:<\/p>\n\n

tfe  tf.contrib.eager\nds = tf.data.TFRecordDataset(...).map(...).batch(...)\nfor x in tfe.Iterator(ds):\n  print(x)\n<\/code><\/pre>\n\n

See these resources associated with the 1.7 release:\n- Notebook<\/a>\n- RNN example<\/a><\/p>\n\n

Hope that helps.<\/p>\n"}]} {"QuestionId":49989414,"AnswerCount":0,"Tags":"","CreationDate":"2018-04-23T20:24:42.247","AcceptedAnswerId":null,"OwnerUserId":5866657.0,"Title":"Is there an easy way to time pytorch code running in GPU?","Body":"

Are there any easy ways to time pytorch code (python) while running in GPU ( not in CPU)? I can simply use the module builtin in python to time code in CPU. However are there any easy way to use functions to time code for GPU? Thanks.<\/p>\n","answers":[]} {"QuestionId":49989776,"AnswerCount":1,"Tags":"","CreationDate":"2018-04-23T20:53:02.397","AcceptedAnswerId":50033064.0,"OwnerUserId":2793857.0,"Title":"How do I load a checkpoint using tensorflow in eager execution mode?","Body":"

I am using tensorflow 1.7.0 in eager execution mode. I have the model working, but none of the examples that I have found for saving the model work. <\/p>\n\n

This is the code that I am using:<\/p>\n\n

<\/pre>\n\n

I have trained the model and use evaluate to check the results when loading from a restart. Each time I get a random result from evaluate, meaning that the model is not loading from the data, but instead only having random weights.<\/p>\n\n

How do I save the model? It can take days to train one of these.<\/p>\n\n

Edit. Here is the model:<\/p>\n\n

<\/pre>\n","answers":[{"AnswerId":"50033064","CreationDate":"2018-04-26T00:22:39.713","ParentId":null,"OwnerUserId":"8858032","Title":null,"Body":"

tfe.Network<\/code> is not (easily) Checkpointable and it will soon be deprecated. Prefer to subclass tf.Keras.Model<\/code> instead. So if you change class EagerRNN(tfe.Network)<\/code> to class EagerRNN(tf.keras.Model)<\/code> and class EagerLSTM_Model(tfe.Network)<\/code> to class EagerLSTM_Model(tf.keras.Model)<\/code>, checkpoint.save(file_prefix=checkpoint_prefix)<\/code> should actually save all your variables and checkpoint.restore(tf.train.latest_checkpoint(checkpoint_directory))<\/code> should restore them.<\/p>\n"}]} {"QuestionId":49989857,"AnswerCount":4,"Tags":"","CreationDate":"2018-04-23T20:59:56.047","AcceptedAnswerId":null,"OwnerUserId":1077657.0,"Title":"Tensorflow evaluation frequency","Body":"

I am using the function in tensorflow and want to make the eval step happen more frequently (either by the global step or time elapsed). This is my code (model function is not shown).<\/p>\n\n

<\/pre>\n\n

I have tried using the parameter in my , im not sure if this is what it is for but it doesn't seem to have any effect anyway<\/p>\n","answers":[{"AnswerId":"50017639","CreationDate":"2018-04-25T08:37:16.233","ParentId":null,"OwnerUserId":"1077657","Title":null,"Body":"

I have found that there is a parameter in EvalSpec, `throttle_secs' which starts the evaluation stage after a number of seconds. Alternatively if you want to evaluate based on a number of steps, you can use a for loop and incrementally increase the max_steps as suggested by @Kathy Wu.<\/p>\n"},{"AnswerId":"49991415","CreationDate":"2018-04-23T23:42:32.307","ParentId":null,"OwnerUserId":"8581827","Title":null,"Body":"

You can set max_steps<\/code> to a lower number in order to evaluate sooner. <\/p>\n\n

This will reset the input function. Currently, there is no way to pause the input function and resume at the same state using estimator. We are looking into adding this feature.<\/p>\n"},{"AnswerId":"53515605","CreationDate":"2018-11-28T08:59:51.587","ParentId":null,"OwnerUserId":"3397796","Title":null,"Body":"

Use tf.contrib.learn.Experiment<\/a> instead.<\/p>\n\n

For example:<\/p>\n\n

experiment = tf.contrib.learn.Experiment(\n\n    estimator=estimator,  # Estimator\n\n    train_input_fn=train_input_fn,  # First-class function\n\n    eval_input_fn=eval_input_fn,  # First-class function\n\n    train_steps=params.train_steps,  # Minibatch steps\n\n    min_eval_frequency=params.min_eval_frequency,  # Eval frequency\n\n    train_monitors=[train_input_hook],  # Hooks for training\n\n    eval_hooks=[eval_input_hook],  # Hooks for evaluation\n\n    eval_steps=None  # Use evaluation feeder until its empty\n\n)\n\nlearn_runner.run(\n\n    experiment_fn=experiment,  # First-class function\n\n    run_config=run_config,  # RunConfig\n\n    schedule=\"train_and_evaluate\",  # What to run\n\n    hparams=params  # HParams\n\n)\n<\/code><\/pre>\n"},{"AnswerId":"54093082","CreationDate":"2019-01-08T13:39:58.687","ParentId":null,"OwnerUserId":"4711583","Title":null,"Body":"

When I set save_checkpoints_steps<\/code>, it does run evaluation after the specified number of steps; The configuration :<\/p>\n\n

tf.estimator.RunConfig(save_summary_steps=5, log_step_count_steps=3, save_checkpoints_steps=40)<\/code><\/p>\n\n

gives an evaluation each 40 steps<\/code>.<\/p>\n"}]} {"QuestionId":49989883,"AnswerCount":0,"Tags":"","CreationDate":"2018-04-23T21:01:30.580","AcceptedAnswerId":null,"OwnerUserId":9262788.0,"Title":"SciPy can't install old version Windows 10","Body":"

I'm trying to install an older version of SciPy (either 0.16.1 or 0.17.0), but when I try to use pip I get the result: <\/p>\n\n

<\/p>\n\n

I get the following message <\/p>\n\n

<\/p>\n\n

So I found the file here https:\/\/www.lfd.uci.edu\/~gohlke\/pythonlibs\/#numpy<\/a> but the problem is that the version here is 1.0.1, and I can't seem to find any older ones, even in the SciPy website (there are for linux and mac) <\/p>\n\n

.
\n. <\/p>\n\n

PS.
\nI need to use either of this versions because I'm trying to run Theano on a GPU, and the tutorial provided here
http:\/\/deeplearning.net\/software\/theano\/install_windows.html<\/a> says this version is a requirement if there is any tutorial that is better and more up-to-date I would be appreciated<\/p>\n","answers":[]} {"QuestionId":49989980,"AnswerCount":0,"Tags":"","CreationDate":"2018-04-23T21:09:17.907","AcceptedAnswerId":null,"OwnerUserId":1293964.0,"Title":"Why Can Wide & Deep Neural Net Work with Non-Normalized Data?","Body":"

My understanding is that inputs to neural networks should be normalized to zero-mean-unit-variant or binary. My own experiment also found that non-normalized network would lead to unstable learning. But the tensorflow Wide and Deep Network example<\/a> uses non-normalized numeric features such as \"age\" and \"capital_gain\" directly. This type of network is not really different from typical fully connected DNN that much. Why does it work with non-normalized numeric data while other DNNs need normalized data? What other types of neural nets can work with non-normalized data?<\/p>\n\n

<\/pre>\n","answers":[]}
{"QuestionId":49990293,"AnswerCount":0,"Tags":"","CreationDate":"2018-04-23T21:31:57.627","AcceptedAnswerId":null,"OwnerUserId":8267756.0,"Title":"Does tensorflow require many syscall and ioctls?","Body":"

when using tensorflow in a single GPU or a multiple GPUs workstation, does tensorflow require many syscall ioctls?<\/p>\n","answers":[]} {"QuestionId":49990882,"AnswerCount":2,"Tags":"","CreationDate":"2018-04-23T22:36:53.450","AcceptedAnswerId":50401718.0,"OwnerUserId":9633224.0,"Title":"Which merge layers to use in keras?","Body":"

Keras has many different ways of merging inputs like , , , , etc...<\/p>\n\n

Do they all have the same effect or are there situations where one is preferable?<\/p>\n","answers":[{"AnswerId":"50401718","CreationDate":"2018-05-17T23:15:18.107","ParentId":null,"OwnerUserId":"9758922","Title":null,"Body":"

It really depends on what you are trying to achieve but briefly let's look at different merge layers and what they are often used for:<\/p>\n\n