Skip to content

Conversation

SCUWQ
Copy link
Contributor

@SCUWQ SCUWQ commented Apr 24, 2023

For pre/post process.

Type: Code Refine

For pre/post process.

Type: Code Refine
/****************************************************************************
*
* Copyright (c) 2020-2023 Vivante Corporation
* Copyright (c) 2020 Vivante Corporation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copyright should not changed.

#define ENABLE_TENSOR_HNDL 1
#endif

#include <stdio.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why include this?

virtual void unmap() = 0;
virtual bool IsPlaceHolder() = 0;
virtual bool IsConstTensor() = 0;
virtual const void* GetDataRef() const = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment for GetDataRef() since this is an dangerous API.

Comment: "Never use this api expect AcuityLite codegen"

virtual bool IsPlaceHolder() = 0;
virtual bool IsConstTensor() = 0;
virtual const void* GetDataRef() const = 0;
virtual bool SaveTensorToTextByFp32(const char* filename) = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest use SaveAsRawFp32( std::ostream& os);

For file operation, you can use ofstream from generated code.

virtual bool IsConstTensor() = 0;
virtual const void* GetDataRef() const = 0;
virtual bool SaveTensorToTextByFp32(const char* filename) = 0;
virtual bool Float32ToDtype(float fval, uint8_t* tensorData, uint32_t stride) = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not be
namespace tim::vx::utils {
float32ToDtype(const std::vector&, uint8_t* destData, TensorSpec& targetSpec);

or
static function of tensor class
}

@sunshinemyson sunshinemyson merged commit 1543efe into VeriSilicon:main Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants