I want to select top-n elements of 3 dimension tensor given the picked elements are all unique. All the elements are sorted by the 2nd column, and I’m selecting top-2 in the example below but I don’t want duplicates in there. Condition: No for loops or tf.map_fn() Here is the input and desired_output that I want: This is what I’m
Tag: tensorflow
I keep getting ValueError: Shapes (10, 1) and (10, 3) are incompatible when training my model
Turning the number of inputs when I call makeModel from 3 to 1 allows the program to run without errors but no training actually happens and the accuracy doesn’t change. Answer LabelEncoder transforms the input to an array of encoded values. i.e if your input is [“paris”, “paris”, “tokyo”, “amsterdam”] then they can be encoded as [0, 0, 1, 2].
Trying to extract patches from image and getting “UnimplementedError: Only support ksizes across space”
I was trying to split my image through 4 patches when I came through the following error: UnimplementedError: Only support ksizes across space Traceback: Answer After further research I was able to manage by changing from: To : And then reshape to obtain 3 channel images:
tensorflow cannot find GPU
I had install “tensorflow-GPU”, CUDA 10.0. and my GPU is GTX1660 ti. I also tested bu CUDA 10.2 and 11. I added cudnn to windows PATH but I still got this error. Answer I found the problem. the problem was versions of CUDA and cudnn.
TF.Keras model.predict is slower than straight Numpy?
Thanks, everyone for trying to help me understand the issue below. I have updated the question and produced a CPU-only run and GPU-only of the run. In general, it also appears that in either case a direct numpy calculation hundreds of times faster than the model. predict(). Hopefully, this clarifies that this does not appear to be a CPU vs
ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type numpy.ndarray). in trying to predict tesla stock
In the end you can see that i have tried converting this into a numpy array but I don’t understand why tensorflow dosen’t support it? I have looked at the other related pages but none seemed to help. Is there some other format i have to do to the data in order to properly fit in model? this is what
Tensorflow: Error when trying transfer learning: Invalid JPEG data or crop window
I am trying to shape my own custom image dataset into the correct input shape for the pretrained MobileNet model on Tensorflow using their tutorial here. My code: After which I continue with the TF tutorial on transfer learning here. However, I ran into this problem where I suspect the JPEG image is corrupted or there is a lack of/problem
validation accuracy not improving
No matter how many epochs I use or change learning rate, my validation accuracy only remains in 50’s. Im using 1 dropout layer right now and if I use 2 dropout layers, my max train accuracy is 40% with 59% validation accuracy. And currently with 1 dropout layer, here’s my results: Again max, it can reach is 59%. Here’s the
Concatenate three inputs of different dimensions in Keras
I have two inputs of same size and then applied word embeddings of vector size 128 and then reshape it giving both inputs shape of (none,1,128), another input which is context has dimension (none,1,18), I want to concatenate these three inputs and then feed the combined output to an LSTM layer. But I am unable to concatenate the inputs as
How to efficiently assign to a slice of a tensor in TensorFlow
I want to assign some values to slices of an input tensor in one of my model in TensorFlow 2.x (I am using 2.2 but ready to accept a solution for 2.1). A non-working template of what I am trying to do is: of course when building this (AddToEven().build(tf.TensorShape([None, None]))) I get the following error: I can achieve this simple