NVIDIA NvNeural SDK  2022.2
GPU inference framework for NVIDIA Nsight Deep Learning Designer
IPoolingLayer.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 NVNERAL_IPOOLINGLAYER_H
27 #define NVNERAL_IPOOLINGLAYER_H
28 
29 #include <nvneural/CoreTypes.h>
30 
31 namespace nvneural {
33  enum class PoolType : std::uint32_t
34  {
35  Invalid = 0,
36  Max = 1,
37  Avg = 2,
38  };
39 
41  class IPoolingLayer : public IRefObject
42  {
43  public:
45  static const IRefObject::TypeId typeID = 0x2e8a0e0dbd99fe82ul;
46 
50  virtual NeuralResult setPoolingType(PoolType poolType) noexcept = 0;
51 
53  virtual PoolType poolingType() const noexcept = 0;
54 
60  virtual NeuralResult setStartPadding(std::size_t startW, std::size_t startH) noexcept = 0;
61 
67  virtual NeuralResult setEndPadding(std::size_t endW, std::size_t endH) noexcept = 0;
68 
76  virtual NeuralResult getPadding(std::size_t* pStartW, std::size_t* pStartH, std::size_t* pEndW, std::size_t* pEndH) const noexcept = 0;
77 
82  virtual NeuralResult setStride(std::size_t strideW, std::size_t strideH) noexcept = 0;
83 
88  virtual NeuralResult getStride(std::size_t* pStrideW, std::size_t* pStrideH) const noexcept = 0;
89 
94  virtual NeuralResult setKernelSize(std::size_t kernelW, std::size_t kernelH) noexcept = 0;
95 
100  virtual NeuralResult getKernelSize(std::size_t* pKernelW, std::size_t* pKernelH) const noexcept = 0;
101  };
102 } // namespace nvneural
103 
104 #endif // NVNEURAL_IPOOLINGLAYER_H
Fundamental NvNeural data types are declared here.
@ Invalid
Invalid value used to guard against uninitialized variables.
NeuralResult
NeuralResult is a generic success/failure result type similar to COM HRESULT.
Definition: CoreTypes.h:275
PoolType
Enumeration describing pooling layer types.
Definition: IPoolingLayer.h:34
@ Avg
Average pooling.
@ Max
Max pooling.
IPoolingLayer is an optional interface implemented by pooling layers.
Definition: IPoolingLayer.h:42
virtual NeuralResult setStartPadding(std::size_t startW, std::size_t startH) noexcept=0
Sets the start padding along the W and H axes.
virtual NeuralResult setPoolingType(PoolType poolType) noexcept=0
Sets the type of pooling operation.
static const IRefObject::TypeId typeID
Interface TypeId for InterfaceOf purposes.
Definition: IPoolingLayer.h:45
virtual NeuralResult setEndPadding(std::size_t endW, std::size_t endH) noexcept=0
Sets the end padding along the W and H axes.
virtual NeuralResult getKernelSize(std::size_t *pKernelW, std::size_t *pKernelH) const noexcept=0
Retrieves the kernel size for the W and H axes.
virtual NeuralResult setKernelSize(std::size_t kernelW, std::size_t kernelH) noexcept=0
Sets the kernel size for the W and H axes.
virtual NeuralResult getStride(std::size_t *pStrideW, std::size_t *pStrideH) const noexcept=0
Retrieves the operation stride for the W and H axes.
virtual PoolType poolingType() const noexcept=0
Returns the type of pooling operation performed by this layer.
virtual NeuralResult getPadding(std::size_t *pStartW, std::size_t *pStartH, std::size_t *pEndW, std::size_t *pEndH) const noexcept=0
Retrieves the start and end padding for the W and H axes.
virtual NeuralResult setStride(std::size_t strideW, std::size_t strideH) noexcept=0
Sets the operation stride for the W and H axes.
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