Files
DeepCamFaceSDK2.0/TEST/test_track/dims.h
2024-12-13 23:33:37 +08:00

165 lines
2.7 KiB
C++

#ifndef __DIMS_H__
#define __DIMS_H__
/*************************************************************************
*
* deepCam Shenzhen CONFIDENTIAL
* FILE: <tag>
*
* [2016] - [2019] DeepCam Shenzhen
* All Rights Reserved.
NOTICE:
* All information contained herein is, and remains the property of DeepCam Shenzhen.
* The intellectual and technical concepts contained herein are proprietary to DeepCam
* Shenzhen and may be covered by China and Foreign Patents,patents in process, and
* are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* DeepCam Shenzhen.
*
*
* Written: Jing.Yi 2021-05-06
* Updated:
**************************************************************************/
#include "typedef.h"
class Dims {
public:
static const S32 MAX_DIMS = 8; //!< The maximum number of dimensions supported for a tensor.
S32 nbDims; //!< The number of dimensions.
S32 d[MAX_DIMS]; //!< The extent of each dimension.
};
class DimsHW : public Dims {
public:
DimsHW(){
nbDims = 2;
d[0] = 0;
d[1] = 0;
}
DimsHW(S32 height, S32 width){
nbDims = 2;
d[0] = height;
d[1] = width;
}
S32 & h(){
return d[0];
}
S32 h() const{
return d[0];
}
S32 & w(){
return d[1];
}
S32 w() const{
return d[1];
}
};
class DimsCHW : public Dims {
public:
DimsCHW(){
nbDims = 3;
d[0] = 0;
d[1] = 0;
d[2] = 0;
}
DimsCHW(S32 channel,S32 height, S32 width){
nbDims = 3;
d[0] = channel;
d[1] = height;
d[2] = width;
}
S32 & c(){
return d[0];
}
S32 c() const{
return d[0];
}
S32 & h(){
return d[1];
}
S32 h() const{
return d[1];
}
S32 & w(){
return d[2];
}
S32 w() const{
return d[2];
}
};
class DimsNCHW : public Dims {
public:
DimsNCHW(){
nbDims = 4;
d[0] = 0;
d[1] = 0;
d[2] = 0;
d[3] = 0;
}
DimsNCHW(S32 batch,S32 channel,S32 height, S32 width){
nbDims = 4;
d[0] = batch;
d[1] = channel;
d[2] = height;
d[3] = width;
}
S32 & n(){
return d[0];
}
S32 n() const{
return d[0];
}
S32 & c(){
return d[1];
}
S32 c() const{
return d[1];
}
S32 & h(){
return d[2];
}
S32 h() const{
return d[2];
}
S32 & w(){
return d[3];
}
S32 w() const{
return d[3];
}
};
#endif