TypeError: softmax() got an unexpected keyword argument ‘axis’
Try this: Then add a softmax layer in this way:
Try this: Then add a softmax layer in this way:
This worked for me on TensorFlow 2.1.0 (per: https://www.tensorflow.org/api_docs/python/tf/config/experimental/set_memory_growth)
To check which devices are available to TensorFlow you can use this and see if the GPU cards are available: Edit Also, you should see this kind of logs if you use TensorFlow Cuda version :
I’m trying to make an array of one-hot vector of integers into an array of one-hot vector that keras will be able to use to fit my model. Here’s the relevant part of the code: Below is an image showing what Y_train and dummy_y actually are. I couldn’t find any documentation for to_categorical that could help me. Thanks in advance.
I am trying to build a predictive model on stock prices. From what I’ve read, LSTM is a good layer to use. I can’t fully understand what my input_shape needs to be for my model though. Here is the tail of my DataFrame I then split the data into train / test This yields: Here’s where I am getting confused. … Read more
Just to answer this question in a little more detail, and as Pavel said, Batch Normalization is just another layer, so you can use it as such to create your desired network architecture. The general use case is to use BN between the linear and non-linear layers in your network, because it normalizes the input … Read more
Simply: categorical_crossentropy (cce) produces a one-hot array containing the probable match for each category, sparse_categorical_crossentropy (scce) produces a category index of the most likely matching category. Consider a classification problem with 5 categories (or classes). In the case of cce, the one-hot target may be [0, 1, 0, 0, 0] and the model may predict [.2, .5, .1, .1, .1] (probably right) In the … Read more
Yes you can run keras models on GPU. Few things you will have to check first. your system has GPU (Nvidia. As AMD doesn’t work yet) You have installed the GPU version of tensorflow You have installed CUDA installation instructions Verify that tensorflow is running with GPU check if GPU is working sess = tf.Session(config=tf.ConfigProto(log_device_placement=True)) for TF … Read more
I’m playing with the reuters-example dataset and it runs fine (my model is trained). I read about how to save a model, so I could load it later to use again. But how do I use this saved model to predict a new text? Do I use models.predict()? Do I have to prepare this text in … Read more
For this question, it’s a simple answer from the primary author: With fit_generator, you can use a generator for the validation data as well. In general, I would recommend using fit_generator, but using train_on_batch works fine too. These methods only exist for the sake of convenience in different use cases, there is no “correct” method. train_on_batch allows you to expressly update … Read more