Comments (6)
Yeah should be -100 follwing the pytorch impl:
def nll_loss(input, target, weight=None, size_average=None, ignore_index=-100,
reduce=None, reduction='mean'):
from torch.
Yes. I tested that also but it said boom on my Windows machine
from torch.
What I meant to say is that this crashes my session at the call of cpp_torch_namespace_nll_loss_self_Tensor_target_Tensor
library(torch)
m = nn_log_softmax(dim=1)
input = torch_randn(3, 5, requires_grad=TRUE)
target = torch_tensor(c(1L, 0L, 4L))
input = m(input)
output = nnf_nll_loss(input, target, ignore_index=-100L)
output
while it should be calling https://github.com/mlverse/torch/blob/master/src/lantern/lantern.h#L1649
from torch.
ok, I'll take a look ASAP
from torch.
This works for me if I do:
target = torch_tensor(c(1L, 0L, 4L), dtype = torch_long())
I could consider making torch_long()
the default dtype when converting from R integers to torch tensors. We did something similar for R doubles
that are converted to Tensors with dtype = torch_float()
. What do you think?
from torch.
Indeed, works with long instead of int. Don't know enough about the C API of lantern/libtorch to give advice. I don't mind specifyng that it is a long. Don't know currently if this impacts speed of anything.
from torch.
Related Issues (20)
- Comparison of `NULL` with torch device causes segfault
- MPS tensor fails in nn_embedding with wrong error code HOT 3
- A simple example of training a neural network for a noob HOT 1
- Multithreading for CPU device on Mac
- Please update 'installation from binary' to 0.11.0 HOT 5
- distr_multivariate_normal does not work with precision matrix
- Mac M2 Max Tensor Matrix Algebra on GPU HOT 4
- Bug when name of dataset is "torch_tensor"
- GPU Installation instructions point to cuda 11.7 documentation but could point to cuda 11.7 installation files directly HOT 1
- cloning module with empty state dict fails HOT 1
- upload the torch to the aws lambda layer HOT 1
- Moderate dimensionality (more than 128) leads to fatal error for nn_linear and nnf_linear HOT 3
- [liblantern CPU compilation ubuntu 22 ] leads to liblantern.so: undefined symbol: HOT 2
- Cannot save any torch tensor or `nn_module` HOT 4
- Release torch 0.12.0
- dataset subset introducing NAs by coercion HOT 1
- cloning nn_module changes type of object
- torch_device errors in latest builds HOT 4
- Cloning of torch module behaves unexpectedly HOT 3
- `nnf_prelu()` fails on MPS device with `Error Placeholder storage has not been allocated on MPS device!` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from torch.