Skip to content

Build error on cpp/custom-dataset #1255

Open
@dribllerrad

Description

@dribllerrad

I'm getting a build error on a data type conversion with this example:
https://github.com/pytorch/examples/tree/main/cpp/custom-dataset

Error message:

error: conversion from 'const long' to 'detail::TensorDataContainer' is ambiguous
[build]     auto tlabel = torch::tensor(data[index].second, torch::kLong);
[build]                                 ^~~~~~~~~~~~~~~~~~

I believe the paths to libtorch and opencv are good because other sample apps using them compile fine.

I've tried playing around with some casts (both with c++ casts and torch method conversions like .to(torch::kFloat) ) but I don't really know the library enough to troubleshoot. Removing the const-ness of the data also didn't help (revert of b2832cc).

torch env

PyTorch version: 2.3.0
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 14.4.1 (arm64)
GCC version: Could not collect
Clang version: 15.0.0 (clang-1500.3.9.4)
CMake version: version 3.29.3
Libc version: N/A

Python version: 3.12.3 (main, Apr  9 2024, 08:09:14) [Clang 15.0.0 (clang-1500.3.9.4)] (64-bit runtime)
Python platform: macOS-14.4.1-arm64-arm-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Apple M1 Max

Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] torch==2.3.0
[pip3] torchaudio==2.3.0
[pip3] torchvision==0.18.0
[conda] Could not collect

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions