/***************************************************************************** * * Copyright (c) 2016-2026 by Sophgo Technologies Inc. All rights reserved. * * The material in this file is confidential and contains trade secrets * of Sophgo Technologies Inc. This is proprietary information owned by * Sophgo Technologies Inc. No part of this work may be disclosed, * reproduced, copied, transmitted, or used in any way for any purpose, * without the express written permission of Sophgo Technologies Inc. * *****************************************************************************/ #ifndef __BM_BLOB_H__ #define __BM_BLOB_H__ #include "bmdef.h" struct bm_mem_desc; typedef struct bm_mem_desc bm_device_mem_t; namespace bmcnn { #define MAX_SHAPE_DIMS 8 struct Shape { union{ struct{ int n,c,h,w; }; struct { int data[MAX_SHAPE_DIMS]; }; }; int dims; Shape(){ dims = 4; for(int i=0; i0?shape_.data[0]:1; } /** * \brief Get feature * * \return Channel number of the blob\n */ inline int channels() const { return shape_.dims>1?shape_.data[1]:1; } /** * \brief Get height of section */ int height() const { return shape_.dims>2?shape_.data[2]:1; } /** * \brief Get width of section. */ int width() const { int w = 1; for(int i=3; i