LaurentMazare / tch-rs

Rust bindings for the C++ api of PyTorch.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tensor to PyTensor

jjh42 opened this issue · comments

This is not really an issue so much as a support request (is there a discord channel or other place recommend to go for help with this library?).

I'm relatively new to rust so I'm probably doing something silly but I cannot figure out how to convert a Tensor into a PyTensor to return a Tensor to python when using python bindings.

e.g. something like

#[pyfunction]
fn new_tensor(py: Python) -> PyTensor {
  let t: Tensor = // make new tensor somehow.
  let py_t: PyTensor = t.into_py(py);
  py_t
}

nevermind just

PyTensor(t) works. duh.