dfalbel / torch

torch from R!
http://dfalbel.github.io/torch
Other
50 stars 5 forks source link

tch_* functions #24

Open dfalbel opened 5 years ago

dfalbel commented 5 years ago

Here is a complete list of torch functions we need to implement. I will use this issue to track progress. The goal is to implement them all in the next 2 weeks.

Here's the code uses to generate the list:

library(httr)
library(xml2)
library(magrittr)

docs <- httr::GET("https://pytorch.org/docs/stable/torch.html")

docs %>% 
  content() %>% 
  xml2::xml_find_all("//code[@class='descname']") %>% 
  xml2::xml_text() %>% 
  unique() %>% 
  sort() %>% 
  paste0("- [ ] `tch_", ., "`") %>% 
  cat(sep = "\n")
Athospd commented 5 years ago

does tch_zeros_like() make sense to be implemented? The doc says that this is the same as tch_zeros() but without the out parameter.

https://pytorch.org/docs/stable/torch.html#torch.zeros_like

dfalbel commented 5 years ago

I think yes, it's commom to see codes like this in pytorch:

def NLLLoss(logs, targets):
    out = torch.zeros_like(targets, dtype=torch.float)
    for i in range(len(targets)):
        out[i] = logs[i][targets[i]]
    return -out.sum()/len(out)
krzjoa commented 4 years ago

What are the plans for the package development? I would willingly contribute to this repo from time to time, if I know what's the most important at the current stage. I think the list above is out-of-date and I've seen you tried to merge a branch with code autogeneration, so the project isn't abandoned :stuck_out_tongue:

dfalbel commented 4 years ago

Hi @krzjoa,

I have plans to push this package forward in 1 or 2 months. For now, I'm sporadically building code-generation tools so we don't need to wrap every torch function.

krzjoa commented 4 years ago

Ok, so I'll be watching the project :sunglasses: I may try to contribute if I'm sure I do not duplicate any auto-generated piece of code.