chromium/services/on_device_model/fake/fake_chrome_ml_api.cc

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "services/on_device_model/fake/fake_chrome_ml_api.h"

#include "base/files/file.h"
#include "base/files/file_util.h"
#include "base/strings/string_number_conversions.h"
#include "services/on_device_model/ml/chrome_ml_api.h"

namespace fake_ml {

void InitDawnProcs(const DawnProcTable& procs) {}

void SetMetricsFns(const ChromeMLMetricsFns* fns) {}

void SetFatalErrorFn(ChromeMLFatalErrorFn error_fn) {}

void SetFatalErrorNonGpuFn(ChromeMLFatalErrorFn error_fn) {}

bool GetEstimatedPerformance(ChromeMLPerformanceInfo* performance_info) {}

bool QueryGPUAdapter(void (*adapter_callback_fn)(WGPUAdapter adapter,
                                                 void* userdata),
                     void* userdata) {}

struct FakeModelInstance {};

struct FakeSessionInstance {};

struct FakeTsModelInstance {};

struct FakeCancelInstance {};

std::string ReadFile(PlatformFile api_file) {}

ChromeMLModel SessionCreateModel(const ChromeMLModelDescriptor* descriptor,
                                 uintptr_t context,
                                 ChromeMLScheduleFn schedule) {}

void DestroyModel(ChromeMLModel model) {}

ChromeMLSafetyResult ClassifyTextSafety(ChromeMLModel model,
                                        const char* text,
                                        float* scores,
                                        size_t* num_scores) {}

ChromeMLSession CreateSession(ChromeMLModel model,
                              const ChromeMLAdaptationDescriptor* descriptor) {}

ChromeMLSession CloneSession(ChromeMLSession session) {}

void DestroySession(ChromeMLSession session) {}

bool SessionExecuteModel(ChromeMLSession session,
                         ChromeMLModel model,
                         const ChromeMLExecuteOptions* options,
                         ChromeMLCancel cancel) {}

void SessionSizeInTokens(ChromeMLSession session,
                         const std::string& text,
                         const ChromeMLSizeInTokensFn& fn) {}

void SessionScore(ChromeMLSession session,
                  const std::string& text,
                  const ChromeMLScoreFn& fn) {}

ChromeMLCancel CreateCancel() {}

void DestroyCancel(ChromeMLCancel cancel) {}

void CancelExecuteModel(ChromeMLCancel cancel) {}

ChromeMLTSModel CreateTSModel(const ChromeMLTSModelDescriptor* descriptor) {}

void DestroyTSModel(ChromeMLTSModel model) {}

ChromeMLSafetyResult TSModelClassifyTextSafety(ChromeMLTSModel model,
                                               const char* text,
                                               float* scores,
                                               size_t* num_scores) {}

const ChromeMLAPI g_api =;

const ChromeMLAPI* GetFakeMlApi() {}

}  // namespace fake_ml