Forked from
Eclipse Projects / aidge / aidge_core
2541 commits behind the upstream repository.
-
Cyril Moineau authoredCyril Moineau authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
TensorImpl.hpp 1.22 KiB
/********************************************************************************
* Copyright (c) 2023 CEA-List
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
********************************************************************************/
#ifndef __AIDGE_TENSORIMPL_H__
#define __AIDGE_TENSORIMPL_H__
#include <cstddef>
#include <cstdio>
#include "utils/Types.h"
namespace Aidge {
class TensorImpl {
public:
TensorImpl() = delete;
TensorImpl(const char *backend) : mBackend(backend){};
virtual void copy(const void *src, NbElts_t length) = 0;
virtual void *rawPtr() = 0;
virtual void setRawPtr(void* /*ptr*/)
{
printf("Cannot set raw pointer for backend %s\n", mBackend);
};
virtual std::size_t scalarSize() const = 0; // Size of one scalar (in bytes)
constexpr const char *backend() const { return mBackend; }
virtual ~TensorImpl() = default;
virtual bool operator==(const TensorImpl &othImpl) const = 0;
private:
const char *mBackend;
};
} // namespace Aidge
#endif /* __AIDGE_TENSORIMPL_H__ */