#pragma once
#include "ggml-cpu.h"
#include "ggml-et-common.h"
#include "ggml-impl.h"
struct ggml_et_cpu_compare_config {
bool enabled; bool use_cpu_result; bool log_differences; float tolerance; size_t max_log_elements; };
static const ggml_et_cpu_compare_config ggml_et_cpu_compare_default_config = {
false,
false,
true,
1e-5f,
10
};
struct ggml_et_cpu_compare_ctx {
ggml_backend_t cpu_backend;
ggml_context * ggml_ctx;
ggml_tensor * cpu_src0;
ggml_tensor * cpu_src1;
ggml_tensor * cpu_src2;
ggml_tensor * cpu_dst;
ggml_cgraph * cpu_graph;
void * cpu_src0_data;
void * cpu_src1_data;
void * cpu_src2_data;
void * cpu_dst_data;
void * et_dst_data;
size_t src0_size;
size_t src1_size;
size_t src2_size;
size_t dst_size;
};
bool ggml_et_cpu_compare_init_pre(ggml_et_cpu_compare_ctx * ctx, const ggml_tensor * node, ggml_op op);
bool ggml_et_cpu_compare_compute_and_check(ggml_et_cpu_compare_ctx * ctx,
const ggml_tensor * node,
const ggml_et_cpu_compare_config * config);
void ggml_et_cpu_compare_free(ggml_et_cpu_compare_ctx * ctx);