libtorch Questions
2
Solved
To my understanding, the built-in PyTorch operations all automatically handle batches through implicit vectorization, allowing parallelism across multiple GPUs.
However, when writing a custom opera...
Obala asked 18/7, 2018 at 11:15
3
Solved
If we << a torch::Tensor
#include <torch/script.h>
int main()
{
torch::Tensor input_torch = torch::zeros({2, 3, 4});
std::cout << input_torch << std::endl;
return 0;
}
w...
2
I asked a similar question about linking a project with OpenCV a few days ago. I got that working, but now I've hit a very weird problem using CMake and adding LibTorch to the project.
If I only u...
2
Solved
i downloaded libtorch and make these files on macbook pro ARM:
example-app/
build/
libtorch/
CMakeLists.txt
example-app.cpp
then i used these commands for build torch:
cmake -DCMAKE_PREFIX_PAT...
2
I have the following configuration in the .pro file
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
CONFIG += thread
SOURCES += main.cpp
INCLUDEPATH += /usr/local/includ...
Airmail asked 24/7, 2019 at 13:7
1
Solved
1
Solved
I am trying to run inference on a jit traced model in C++ and currently the output I get in Python is different than the output I get in C++.
Initially I thought this be caused by the jit model its...
2
Solved
I'm currently using the has_storage() method to check whether a tensor is empty or not, but I wonder if there is anything better other than this! and whether there are any implications involved in ...
1
Solved
I'm using the same traced model in pytorch and libtorch but I'm getting different outputs.
Python Code:
import cv2
import numpy as np
import torch
import torchvision
from torchvision import transf...
2
Solved
I have a std::vector<std::vector<double>> where I want to conver it into a torch::Tensor in libtorch. However it seems, the torch::tensor(), or torch::from_blob(), can't be used for thi...
3
Using the C++ libtorch frontend for Pytorch
I want to create a torch::Tensor from a C++ double[] array. Comming from a legacy C/C++ API.
I could not find a simple documentation about the subject no...
1
Solved
In the official PyTorch C++ examples on GitHub Here
you can witness a strange definition of a class:
class CustomDataset : public torch::data::datasets::Dataset<CustomDataset> {...}
My und...
1
Solved
I'm trying to build a program using cmake. For several reasons, the program must be built using static libraries rather than dynamic libraries, and I need to use PyTorch so this is what I've done:
...
Authority asked 11/3, 2020 at 5:4
2
Solved
In Python given a 2-D tensor, we can use tensor[:,:2] to slice the a 2x2 matrix of the first two elements in the top left of the matrix, e.g. :
x = torch.tensor([[-1.4673, 0.9980, -2.1427, -1.1798...
1
Solved
I am using torch C++ frontend and want to have a tensor with specified value in it. To achieve this one may allocate memory and set value by hand, then use torch::from_blob to build a tensor on the...
0
I have around 26 static libraries such as liba.a, libb.a, libc.a, ..., libz.a. There are two catches here:
1) circular dependencies between for example liba.a and libb.a;
2) some lib*.a has stati...
Adversity asked 27/5, 2019 at 9:24
1
Solved
In the C++ version of Libtorch, I found that I can get the value of a float tensor by *tensor_name[0].data<float>(), in which instead of 0 I can use any other valid index. But, when I have de...
1
© 2022 - 2024 — McMap. All rights reserved.