Open3D (C++ API)  0.18.0
Loading...
Searching...
No Matches
ContinuousConvHelper.h
Go to the documentation of this file.
1// ----------------------------------------------------------------------------
2// - Open3D: www.open3d.org -
3// ----------------------------------------------------------------------------
4// Copyright (c) 2018-2023 www.open3d.org
5// SPDX-License-Identifier: MIT
6// ----------------------------------------------------------------------------
7//
8#pragma once
9
10#include <string>
11
13#include "torch/script.h"
14
15//
16// helper functions for parsing arguments
17//
18
20 const std::string& str) {
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
40 const std::string& str) {
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}
open3d::ml::impl::CoordinateMapping ParseCoordinateMappingStr(const std::string &str)
Definition ContinuousConvHelper.h:19
open3d::ml::impl::InterpolationMode ParseInterpolationStr(const std::string &str)
Definition ContinuousConvHelper.h:39
InterpolationMode
Definition ContinuousConvTypes.h:18
CoordinateMapping
Definition ContinuousConvTypes.h:26