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...
Photochemistry asked 18/2, 2021 at 22:18

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...
Alessandraalessandria asked 1/6, 2020 at 1:45

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...
Dimmick asked 6/1, 2021 at 9:24

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

When testing a network in PyTorch one can use with torch.no_grad():. What is the Libtorch (C++) equivalent? Thanks!
Oestriol asked 27/1, 2021 at 14:0

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...
Homosexual asked 24/8, 2020 at 4:39

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 ...
Anuradhapura asked 19/8, 2020 at 3:53

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...
Approver asked 20/8, 2020 at 9:46

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...
Sterculiaceous asked 18/8, 2020 at 10:36

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...
Byelorussian asked 30/10, 2019 at 18:14

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...
Allisonallissa asked 20/4, 2020 at 3:49

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...
Soapbark asked 21/6, 2019 at 6:34

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...
Moira asked 10/1, 2020 at 7:13

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...
Calcine asked 15/1, 2019 at 14:22
1

© 2022 - 2024 — McMap. All rights reserved.