NVIDIA NvNeural SDK  2022.2
GPU inference framework for NVIDIA Nsight Deep Learning Designer
IStandardInputLayer.h
Go to the documentation of this file.
1 /*
2 * SPDX-FileCopyrightText: Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: MIT
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23 
25 
26 #ifndef NVNEURAL_ISTANDARDINPUTLAYER_H
27 #define NVNEURAL_ISTANDARDINPUTLAYER_H
28 
29 #include <nvneural/CoreTypes.h>
30 
31 namespace nvneural {
32 
37 {
38 public:
40  static const IRefObject::TypeId typeID = 0xa6746df041d5e61aul;
41 
52 
54  virtual std::size_t tilingFactor() const noexcept = 0;
55 
60  virtual NeuralResult setTilingFactor(std::size_t tileFactor) noexcept = 0;
61 
63  virtual std::size_t minimumChannelCount() const noexcept = 0;
64 
69  virtual NeuralResult setMinimumChannelCount(std::size_t minChannels) noexcept = 0;
70 
75  virtual NeuralResult regeneratePlaceholderNoise() noexcept = 0;
76 
78  virtual TensorDimension placeholderSize() const noexcept = 0;
79 
85 
89  virtual bool imagesUseAlpha() const noexcept = 0;
90 
95  virtual NeuralResult setImagesUseAlpha(bool rgba) noexcept = 0;
96 
98 
107 
111  virtual NeuralResult setImageShift(float shift) noexcept = 0;
112 
114  virtual float imageShift() const noexcept = 0;
115 
119  virtual NeuralResult setImageScale(float scale) noexcept = 0;
120 
122  virtual float imageScale() const noexcept = 0;
123 
125 
137 
141  virtual NeuralResult loadDetectedFile(const char* filename) noexcept = 0;
142 
150  virtual NeuralResult loadNumpy(const char* filename) noexcept = 0;
151 
153  virtual NeuralResult loadImage(const char* filename) noexcept = 0;
154 
156  virtual NeuralResult loadImageBuffer(const std::uint8_t* pBuffer, TensorDimension bufferSize) noexcept = 0;
157 
165  virtual NeuralResult loadCpuBuffer(const void* pBuffer, TensorDimension bufferSize, TensorFormat bufferFormat) noexcept = 0;
166 
168 }; // IStandardInputLayer
169 } // namespace nvneural
170 
171 #endif // NVNEURAL_ISTANDARDINPUTLAYER_H
Fundamental NvNeural data types are declared here.
NeuralResult
NeuralResult is a generic success/failure result type similar to COM HRESULT.
Definition: CoreTypes.h:275
Base class for all objects, similar to COM's IUnknown.
Definition: CoreTypes.h:343
std::uint64_t TypeId
Every interface must define a unique TypeId. This should be randomized.
Definition: CoreTypes.h:349
Defines a standard input layer.
Definition: IStandardInputLayer.h:37
virtual NeuralResult loadCpuBuffer(const void *pBuffer, TensorDimension bufferSize, TensorFormat bufferFormat) noexcept=0
Loads a tensor from a raw CPU buffer.
virtual NeuralResult setPlaceholderSize(TensorDimension placeholderSize) noexcept=0
Sets a new default size for placeholder data.
virtual NeuralResult loadImageBuffer(const std::uint8_t *pBuffer, TensorDimension bufferSize) noexcept=0
Loads a tensor from a decoded image bitmap in NCHW layout. Applies shift and scale transforms.
virtual NeuralResult regeneratePlaceholderNoise() noexcept=0
Requests new placeholder noise.
virtual NeuralResult loadImage(const char *filename) noexcept=0
Loads a tensor from an image file on disk. Applies shift and scale transforms.
virtual NeuralResult setImageShift(float shift) noexcept=0
Set a new shift coefficient for loadImage calls.
virtual bool imagesUseAlpha() const noexcept=0
Returns true if alpha channels will be preserved in loaded images.
static const IRefObject::TypeId typeID
Interface TypeId for InterfaceOf purposes.
Definition: IStandardInputLayer.h:40
virtual NeuralResult setImagesUseAlpha(bool rgba) noexcept=0
Control whether alpha channels will be preserved in loaded images.
virtual NeuralResult loadDetectedFile(const char *filename) noexcept=0
Loads a tensor from a disk file using either loadNumpy or loadImage as appropriate.
virtual std::size_t tilingFactor() const noexcept=0
Retrieves the current H/W tiling value. Zero means no tiling.
virtual float imageShift() const noexcept=0
Get the current shift coefficient for loadImage calls.
virtual float imageScale() const noexcept=0
Get the current scale coefficient for loadImage calls.
virtual TensorDimension placeholderSize() const noexcept=0
Retrieves the current size for autogenerated placeholder data.
virtual NeuralResult setImageScale(float scale) noexcept=0
Set a new scale coefficient for loadImage calls.
virtual NeuralResult loadNumpy(const char *filename) noexcept=0
Loads a tensor from a NumPy (.npy) tensor on disk.
virtual std::size_t minimumChannelCount() const noexcept=0
Retrieves the current minimum channel count. Zero means no minimum.
virtual NeuralResult setTilingFactor(std::size_t tileFactor) noexcept=0
Sets a new H/W tiling value.
virtual NeuralResult setMinimumChannelCount(std::size_t minChannels) noexcept=0
Sets a new minimum channel count.
TensorDimension describes the dimensions of a four-dimensional image tensor.
Definition: CoreTypes.h:136
TensorFormat describes a specific tensor shape (element type and layout).
Definition: CoreTypes.h:88