IDF release/v4.4 a79dc75f0a (#6048)

This commit is contained in:
Me No Dev
2021-12-21 15:14:41 +02:00
committed by GitHub
parent 7cf162346a
commit 1c94c38dbb
82 changed files with 214 additions and 191 deletions

View File

@ -375,7 +375,9 @@
#define CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS 5
#define CONFIG_LWIP_ICMP 1
#define CONFIG_LWIP_MAX_RAW_PCBS 16
#define CONFIG_LWIP_SNTP_MAX_SERVERS 1
#define CONFIG_LWIP_SNTP_MAX_SERVERS 3
#define CONFIG_LWIP_DHCP_GET_NTP_SRV 1
#define CONFIG_LWIP_DHCP_MAX_NTP_SERVERS 1
#define CONFIG_LWIP_SNTP_UPDATE_DELAY 3600000
#define CONFIG_LWIP_ESP_LWIP_ASSERT 1
#define CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT 1
@ -630,5 +632,5 @@
#define CONFIG_TIMER_TASK_STACK_SIZE CONFIG_ESP_TIMER_TASK_STACK_SIZE
#define CONFIG_TOOLPREFIX CONFIG_SDK_TOOLPREFIX
#define CONFIG_UDP_RECVMBOX_SIZE CONFIG_LWIP_UDP_RECVMBOX_SIZE
#define CONFIG_ARDUINO_IDF_COMMIT "f23dcd3555"
#define CONFIG_ARDUINO_IDF_COMMIT "a79dc75f0a"
#define CONFIG_ARDUINO_IDF_BRANCH "release/v4.4"

View File

@ -66,19 +66,18 @@ namespace dl
this->output_exponent = input.exponent;
if (!this->inplace)
{
if (this->output != NULL)
if (this->output == NULL)
{
this->output = new Tensor<feature_t>;
}
this->output->set_exponent(this->output_exponent);
this->output->set_shape(this->output_shape);
this->output->set_shape(input.shape);
this->output->expand_dims(this->axis);
this->output->free_element();
}
else
{
this->output = &input;
this->output->set_shape(this->output_shape);
this->output->expand_dims(this->axis);
}
this->output_shape = this->output->shape;

View File

@ -59,7 +59,7 @@ namespace dl
this->output_shape = {input.get_size()};
if (!this->inplace)
{
if (this->output != NULL)
if (this->output == NULL)
{
this->output = new Tensor<feature_t>;
}

View File

@ -10,14 +10,14 @@ namespace dl
namespace layer
{
/**
* @brief LeakyReLU(input).
* @brief LeakyRelu(input).
*
* @tparam feature_t supports int16_t and int8_t,
* - int16_t: stands for operation in int16_t quantize
* - int8_t: stands for operation in int8_t quantize
*/
template <typename feature_t>
class LeakyReLU : public Layer
class LeakyRelu : public Layer
{
private:
feature_t activation_alpha; /*<! quantized alpha >*/
@ -28,7 +28,7 @@ namespace dl
std::vector<int> output_shape; /*<! output shape of leakyrelu >*/
public:
/**
* @brief Construct a new LeakyReLU object
* @brief Construct a new LeakyRelu object
*
* @param activation_alpha quantized alpha
* @param activation_exponent exponent of quantized alpha
@ -36,7 +36,7 @@ namespace dl
* @param inplace true: the output will store to input0
* false: the output will store to a separate memory
*/
LeakyReLU(const int activation_alpha, const int activation_exponent, const char *name = "LeakyReLU", bool inplace = false) : Layer(name), output(NULL), output_shape({})
LeakyRelu(const int activation_alpha, const int activation_exponent, const char *name = "LeakyRelu", bool inplace = false) : Layer(name), output(NULL), output_shape({})
{
this->activation_alpha = activation_alpha;
this->activation_exponent = activation_exponent;
@ -44,10 +44,10 @@ namespace dl
}
/**
* @brief Destroy the LeakyReLU object
* @brief Destroy the LeakyRelu object
*
*/
~LeakyReLU()
~LeakyRelu()
{
if ((!this->inplace) && (this->output != NULL))
{
@ -66,7 +66,7 @@ namespace dl
this->output_shape = input.shape;
if (!this->inplace)
{
if (this->output != NULL)
if (this->output == NULL)
{
this->output = new Tensor<feature_t>;
}
@ -90,7 +90,7 @@ namespace dl
/**
* @brief Get the output
*
* @return Tensor<feature_t>& LeakyReLU result
* @return Tensor<feature_t>& LeakyRelu result
*/
Tensor<feature_t> &get_output()
{
@ -98,11 +98,11 @@ namespace dl
}
/**
* @brief Call LeakyReLU operation.
* @brief Call LeakyRelu operation.
*
* @param input as an input
* @param assign_core not effective yet
* @return LeakyReLU result
* @return LeakyRelu result
*/
Tensor<feature_t> &call(Tensor<feature_t> &input, const std::vector<int> &assign_core = CONFIG_DEFAULT_ASSIGN_CORE)
{
@ -130,7 +130,7 @@ namespace dl
{
this->output->set_shape(this->output_shape);
}
nn::leakyrelu<true>(*this->output, input, this->activation_alpha, this->activation_exponent, assign_core);
nn::leakyrelu(*this->output, input, this->activation_alpha, this->activation_exponent, assign_core);
DL_LOG_LAYER_LATENCY_END(this->name, "leakyrelu");
}

View File

@ -68,7 +68,7 @@ namespace dl
if (!this->inplace)
{
if (this->output != NULL)
if (this->output == NULL)
{
this->output = new Tensor<feature_t>;
}
@ -132,7 +132,7 @@ namespace dl
{
this->output->set_shape(this->output_shape);
}
nn::max2d<true>(*this->output, input0, input1, assign_core);
nn::max2d(*this->output, input0, input1, assign_core);
DL_LOG_LAYER_LATENCY_END(this->name, "max2d");
}

View File

@ -68,7 +68,7 @@ namespace dl
if (!this->inplace)
{
if (this->output != NULL)
if (this->output == NULL)
{
this->output = new Tensor<feature_t>;
}
@ -132,7 +132,7 @@ namespace dl
{
this->output->set_shape(this->output_shape);
}
nn::min2d<true>(*this->output, input0, input1, assign_core);
nn::min2d(*this->output, input0, input1, assign_core);
DL_LOG_LAYER_LATENCY_END(this->name, "min2d");
}

View File

@ -75,7 +75,7 @@ namespace dl
if (!this->inplace)
{
if (this->output != NULL)
if (this->output == NULL)
{
this->output = new Tensor<feature_t>;
}
@ -140,7 +140,7 @@ namespace dl
{
this->output->set_shape(this->output_shape);
}
nn::mul2d<true>(*this->output, input0, input1, this->activation, assign_core);
nn::mul2d(*this->output, input0, input1, this->activation, assign_core);
DL_LOG_LAYER_LATENCY_END(this->name, "mul2d");
}

View File

@ -10,17 +10,17 @@ namespace dl
namespace layer
{
/**
* @brief PReLU(input).
* @brief PRelu(input).
*
* @tparam feature_t supports int16_t and int8_t,
* - int16_t: stands for operation in int16_t quantize
* - int8_t: stands for operation in int8_t quantize
*/
template <typename feature_t>
class PReLU : public Layer
class PRelu : public Layer
{
private:
feature_t *activation_element; /*<! quantized alpha elements along channel axis >*/
const feature_t *activation_element; /*<! quantized alpha elements along channel axis >*/
int activation_exponent; /*<! exponent of quantized alpha elements >*/
Tensor<feature_t> *output; /*<! output ptr of prelu >*/
bool inplace; /*<! true: the output will store to input0
@ -28,7 +28,7 @@ namespace dl
std::vector<int> output_shape; /*<! output shape of prelu >*/
public:
/**
* @brief Construct a new PReLU object
* @brief Construct a new PRelu object
*
* @param activation_element quantized alpha elements along channel axis
* @param activation_exponent exponent of quantized alpha elements
@ -36,10 +36,10 @@ namespace dl
* @param inplace true: the output will store to input0
* false: the output will store to a separate memory
*/
PReLU(const feature_t *activation_element,
PRelu(const feature_t *activation_element,
const int activation_exponent = 0,
const char *name = NULL,
bool inplace = "PReLU") : Layer(name),
const char *name = "PRelu",
bool inplace = false) : Layer(name),
activation_element(activation_element),
activation_exponent(activation_exponent),
output(NULL),
@ -49,10 +49,10 @@ namespace dl
}
/**
* @brief Destroy the PReLU object
* @brief Destroy the PRelu object
*
*/
~PReLU()
~PRelu()
{
if ((!this->inplace) && (this->output != NULL))
{
@ -71,7 +71,7 @@ namespace dl
this->output_shape = input.shape;
if (!this->inplace)
{
if (this->output != NULL)
if (this->output == NULL)
{
this->output = new Tensor<feature_t>;
}
@ -94,7 +94,7 @@ namespace dl
/**
* @brief Get the output
*
* @return Tensor<feature_t>& PReLU result
* @return Tensor<feature_t>& PRelu result
*/
Tensor<feature_t> &get_output()
{
@ -102,11 +102,11 @@ namespace dl
}
/**
* @brief Call PReLU operation.
* @brief Call PRelu operation.
*
* @param input as an input
* @param assign_core not effective yet
* @return PReLU result
* @return PRelu result
*/
Tensor<feature_t> &call(Tensor<feature_t> &input, const std::vector<int> &assign_core = CONFIG_DEFAULT_ASSIGN_CORE)
{
@ -125,7 +125,7 @@ namespace dl
DL_LOG_LAYER_LATENCY_START();
nn::prelu(*this->output, input, this->activation_element, this->activation_exponent, assign_core);
DL_LOG_LAYER_LATENCY_END(this->name, "leakyrelu");
DL_LOG_LAYER_LATENCY_END(this->name, "prelu");
}
else
{
@ -135,7 +135,7 @@ namespace dl
this->output->set_shape(this->output_shape);
}
nn::prelu(*this->output, input, this->activation_element, this->activation_exponent, assign_core);
DL_LOG_LAYER_LATENCY_END(this->name, "leakyrelu");
DL_LOG_LAYER_LATENCY_END(this->name, "prelu");
}
return *this->output;

View File

@ -61,7 +61,7 @@ namespace dl
this->output_shape = input.shape;
if (!this->inplace)
{
if (this->output != NULL)
if (this->output == NULL)
{
this->output = new Tensor<feature_t>;
}

View File

@ -64,19 +64,21 @@ namespace dl
this->output_exponent = input.exponent;
if (!this->inplace)
{
if (this->output != NULL)
if (this->output == NULL)
{
this->output = new Tensor<feature_t>;
}
this->output->set_exponent(this->output_exponent);
this->output->set_shape(this->output_shape);
this->output->set_shape(input.shape);
this->output->reshape(this->output_shape);
this->output->free_element();
}
else
{
this->output = &input;
this->output->set_shape(this->output_shape);
this->output->reshape(this->output_shape);
}
this->output_shape = this->output->shape;
if (print_shape)
{

View File

@ -66,7 +66,7 @@ namespace dl
this->output_exponent = input.exponent;
if (!this->inplace)
{
if (this->output != NULL)
if (this->output == NULL)
{
this->output = new Tensor<feature_t>;
}
@ -78,7 +78,6 @@ namespace dl
else
{
this->output = &input;
this->output->set_shape(input.shape);
this->output->squeeze(this->axis);
}
this->output_shape = this->output->shape;

View File

@ -71,7 +71,7 @@ namespace dl
this->output_shape = input0.shape;
if (!this->inplace)
{
if (this->output != NULL)
if (this->output == NULL)
{
this->output = new Tensor<feature_t>;
}
@ -120,12 +120,12 @@ namespace dl
{
this->output->set_shape(this->output_shape);
}
this->output.malloc_element();
this->output->malloc_element();
this->output->set_exponent(input0.exponent);
DL_LOG_LAYER_LATENCY_END(this->name, "apply");
DL_LOG_LAYER_LATENCY_START();
nn::sub2d(this->output, input0, input1, this->activation, assign_core);
nn::sub2d(*this->output, input0, input1, this->activation, assign_core);
DL_LOG_LAYER_LATENCY_END(this->name, "sub2d");
}
else
@ -135,7 +135,7 @@ namespace dl
{
this->output->set_shape(this->output_shape);
}
nn::sub2d<true>(this->output, input0, input1, this->activation, assign_core, this->output_exponent);
nn::sub2d(*this->output, input0, input1, this->activation, assign_core, this->output_exponent);
DL_LOG_LAYER_LATENCY_END(this->name, "sub2d");
}
return *this->output;

View File

@ -63,13 +63,24 @@ namespace dl
{
this->output_exponent = input.exponent;
this->output_shape = input.shape;
for (int i = 0; i < this->perm.size(); i++)
int dims = this->output_shape.size();
if (this->perm.size() == 0)
{
for (int i = dims - 1; i >= 0; i--)
{
this->perm.push_back(i);
}
}
for (int i = 0; i < dims; ++i)
{
if (this->perm[i] < 0)
this->perm[i] = dims + this->perm[i];
this->output_shape[i] = input.shape[this->perm[i]];
}
if (!this->inplace)
{
if (this->output != NULL)
if (this->output == NULL)
{
this->output = new Tensor<feature_t>;
}

View File

@ -396,9 +396,6 @@ namespace dl
* @brief print all the element of the Tensor.
*
* @param message to print
* @param with_padding one of true or false,
* - true: the padding element will also be ed
* - false: the padding element will not be ed
*/
void print_all(const char *message = "")
{
@ -553,4 +550,4 @@ namespace dl
return output;
}
};
} // namespace dl
} // namespace dl