Open3D (C++ API)
0.19.0
Toggle main menu visibility
Loading...
Searching...
No Matches
cpp
open3d
ml
pytorch
continuous_conv
ContinuousConvHelper.h
Go to the documentation of this file.
1
// ----------------------------------------------------------------------------
2
// - Open3D: www.open3d.org -
3
// ----------------------------------------------------------------------------
4
// Copyright (c) 2018-2024 www.open3d.org
5
// SPDX-License-Identifier: MIT
6
// ----------------------------------------------------------------------------
7
//
8
#pragma once
9
10
#include <string>
11
12
#include "
open3d/ml/impl/continuous_conv/ContinuousConvTypes.h
"
13
#include "torch/script.h"
14
15
//
16
// helper functions for parsing arguments
17
//
18
19
inline
open3d::ml::impl::CoordinateMapping
ParseCoordinateMappingStr
(
20
const
std::string& str) {
21
using
open3d::ml::impl::CoordinateMapping
;
22
CoordinateMapping coordinate_mapping =
23
CoordinateMapping::BALL_TO_CUBE_RADIAL;
24
if
(str ==
"ball_to_cube_radial"
) {
25
coordinate_mapping = CoordinateMapping::BALL_TO_CUBE_RADIAL;
26
}
else
if
(str ==
"ball_to_cube_volume_preserving"
) {
27
coordinate_mapping = CoordinateMapping::BALL_TO_CUBE_VOLUME_PRESERVING;
28
}
else
if
(str ==
"identity"
) {
29
coordinate_mapping = CoordinateMapping::IDENTITY;
30
}
else
{
31
TORCH_CHECK(
false
,
32
"coordinate_mapping must be one of ('ball_to_cube_radial', "
33
"'ball_to_cube_volume_preserving', 'identity') but got "
+
34
str);
35
}
36
return
coordinate_mapping;
37
}
38
39
inline
open3d::ml::impl::InterpolationMode
ParseInterpolationStr
(
40
const
std::string& str) {
41
using
open3d::ml::impl::InterpolationMode
;
42
InterpolationMode interpolation = InterpolationMode::LINEAR;
43
if
(str ==
"linear"
) {
44
interpolation = InterpolationMode::LINEAR;
45
}
else
if
(str ==
"linear_border"
) {
46
interpolation = InterpolationMode::LINEAR_BORDER;
47
}
else
if
(str ==
"nearest_neighbor"
) {
48
interpolation = InterpolationMode::NEAREST_NEIGHBOR;
49
}
else
{
50
TORCH_CHECK(
false
,
51
"interpolation must be one of ('linear', "
52
"'linear_border', 'nearest_neighbor') but got "
+
53
str);
54
}
55
return
interpolation;
56
}
ParseCoordinateMappingStr
open3d::ml::impl::CoordinateMapping ParseCoordinateMappingStr(const std::string &str)
Definition
ContinuousConvHelper.h:19
ParseInterpolationStr
open3d::ml::impl::InterpolationMode ParseInterpolationStr(const std::string &str)
Definition
ContinuousConvHelper.h:39
ContinuousConvTypes.h
open3d::ml::impl::InterpolationMode
InterpolationMode
Definition
ContinuousConvTypes.h:18
open3d::ml::impl::CoordinateMapping
CoordinateMapping
Definition
ContinuousConvTypes.h:26
Generated by
1.17.0