TfLiteStatus ValidateCustomAllocationForTensor(
    TfLiteContext* context, const TfLiteTensor* tensor,
    const TfLiteCustomAllocation& allocation) {
  TF_LITE_ENSURE(context, allocation.data != nullptr);
  TF_LITE_ENSURE(context, allocation.bytes >= tensor->bytes);
  // Ensure provided memory is aligned to what TFLite requires.
  const intptr_t data_ptr_value = reinterpret_cast<intptr_t>(allocation.data);
  TF_LITE_ENSURE(context, data_ptr_value % kDefaultTensorAlignment == 0);
  return kTfLiteOk;
}
TfLiteStatus ValidateCustomAllocationForTensor(
    TfLiteContext* context, const TfLiteTensor* tensor,
    const TfLiteCustomAllocation& allocation) {
  TF_LITE_ENSURE(context, allocation.data != nullptr);
  TF_LITE_ENSURE(context, allocation.bytes >= tensor->bytes);
   
  const intptr_t data_ptr_value = reinterpret_cast<intptr_t>(allocation.data);
  TF_LITE_ENSURE(context, data_ptr_value % kDefaultTensorAlignment == 0);
  return kTfLiteOk;
}