I have output with dimension batch_size x 14 x 100 (14 object x 100 classes). I want to do cross-entropy loss with ground truth indices provided with dimension batch_size x 14. However, when I use torch.functional.cross_entropy, I get the error message that says Expected target size [15, 100], got [15, 14]. Does anyone know what the reason is?
Thank you in advance
How to do PyTorch F.cross_entropy?
270 Views Asked by ryan chandra At
1
There are 1 best solutions below
Related Questions in PYTORCH
- Influence of Unused FFN on Model Accuracy in PyTorch
- Conda CMAKE CXX Compiler error while compiling Pytorch
- Which library can replace causal_conv1d in machine learning programming?
- yolo v5 export to torchscript: how to generate constants.pkl
- Pytorch distribute process across nodes and gpu
- My ICNN doesn't seem to work for any n_hidden
- a problem for save and load a pytorch model
- The meaning of an out_channel in nn.Conv2d pytorch
- config QConfig in pytorch QAT
- Can't load the saved model in PyTorch
- How can I convert a flax.linen.Module to a torch.nn.Module?
- Snuffle in PyTorch Dataloader
- Cuda out of Memory but I have no free space
- Can not load scripted model using torch::jit::load
- Should I train my model with a set of pictures as one input data or I need to crop to small one using Pytorch
Related Questions in CROSS-ENTROPY
- Formula for Cross-Entropy Loss for Vector Inputs
- Medical Binary Classification probability : BCE vs CrossEntropy
- Tensorflow: Incompatible shapes: [1,896] vs. [1,32] [[{{node LogicalAnd_3}}]] [Op:__inference_one_step_on_iterator_6201]
- Accessing the N values of PyTorch's Cross-Entropy loss function
- CrossEntropyLoss loss function type problem
- Why categorical_crossentropy gives 16?
- Is there an easy way to replace fmincon with the cross-entropy method for optimization problems
- Pytorch's `binary_cross_entropy` seems to implement ln(0) = -100. Why?
- What causes this model to not improve?
- Suppose logits are a 3*4 matrix, and the target is a 1*3, how is cross-entropy loss calculated mathematically?
- Problem replicating a comparison between CE and MSE
- Pytorch CrossEntropy Loss, getting error: "RuntimeError: Boolean value of Tensor with more than one value is ambiguous"
- Tensorflow binary classifier with weighted loss function - Why does train history accuracy doesn't match train accuracy?
- How to do PyTorch F.cross_entropy?
- Can you use perplexity to guess the language of a document?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
See the cross entropy documentation
For higher dim inputs, the inputs and targets are expected to be of size
(N, C, d_1, ... d_k)and(N, d_1, ... d_k)whereNis the batch size andCis the number of classes.Your output should be of shape
batch_size x 100 x 14rather thanbatch_size x 14 x 100