#include "services/webnn/webnn_test_utils.h"
#include "base/check_is_test.h"
#include "services/webnn/public/cpp/context_properties.h"
#include "services/webnn/webnn_context_impl.h"
namespace webnn {
GraphInfoBuilder::GraphInfoBuilder() { … }
GraphInfoBuilder::~GraphInfoBuilder() = default;
uint64_t GraphInfoBuilder::BuildOperand(const std::vector<uint32_t>& dimensions,
OperandDataType type,
mojom::Operand::Kind kind) { … }
uint64_t GraphInfoBuilder::BuildIntermediateOperand(
const std::vector<uint32_t>& dimensions,
OperandDataType type) { … }
uint64_t GraphInfoBuilder::BuildInput(const std::string& name,
const std::vector<uint32_t>& dimensions,
OperandDataType type) { … }
uint64_t GraphInfoBuilder::BuildConstant(
const std::vector<uint32_t>& dimensions,
OperandDataType type,
base::span<const uint8_t> values) { … }
void GraphInfoBuilder::AddOutput(const std::string& name, uint64_t operand_id) { … }
uint64_t GraphInfoBuilder::BuildOutput(const std::string& name,
const std::vector<uint32_t>& dimensions,
OperandDataType type) { … }
void GraphInfoBuilder::BuildArgMinMax(mojom::ArgMinMax::Kind kind,
uint64_t input_operand_id,
uint64_t output_operand_id,
uint32_t axis,
bool keep_dimensions) { … }
void GraphInfoBuilder::BuildElu(uint64_t input_operand_id,
uint64_t output_operand_id,
float alpha) { … }
void GraphInfoBuilder::BuildLeakyRelu(uint64_t input_operand_id,
uint64_t output_operand_id,
float alpha) { … }
void GraphInfoBuilder::BuildLinear(uint64_t input_operand_id,
uint64_t output_operand_id,
float alpha,
float beta) { … }
void GraphInfoBuilder::BuildPad(uint64_t input_operand_id,
uint64_t output_operand_id,
const std::vector<uint32_t>& beginning_padding,
const std::vector<uint32_t>& ending_padding,
mojom::PaddingMode::Tag mode,
float value) { … }
void GraphInfoBuilder::BuildSplit(
uint64_t input_operand_id,
const std::vector<uint64_t>& output_operand_ids,
uint32_t axis) { … }
void GraphInfoBuilder::BuildClamp(uint64_t input_operand_id,
uint64_t output_operand_id,
float min_value,
float max_value) { … }
void GraphInfoBuilder::BuildConcat(std::vector<uint64_t> input_operand_ids,
uint64_t output_operand_id,
uint32_t axis) { … }
void GraphInfoBuilder::BuildElementWiseBinary(
mojom::ElementWiseBinary::Kind kind,
uint64_t lhs_operand,
uint64_t rhs_operand,
uint64_t output_operand) { … }
void GraphInfoBuilder::BuildExpand(uint64_t input_operand_id,
uint64_t output_operand_id) { … }
void GraphInfoBuilder::BuildMatmul(uint64_t a_operand_id,
uint64_t b_operand_id,
uint64_t output_operand_id) { … }
void GraphInfoBuilder::BuildElementWiseUnary(mojom::ElementWiseUnary::Kind kind,
uint64_t input_operand,
uint64_t output_operand) { … }
void GraphInfoBuilder::BuildGather(uint64_t input_operand_id,
uint64_t indices_operand_id,
uint64_t output_operand_id,
uint32_t axis) { … }
void GraphInfoBuilder::BuildGatherElements(uint64_t input_operand_id,
uint64_t indices_operand_id,
uint64_t output_operand_id,
uint32_t axis) { … }
void GraphInfoBuilder::BuildGelu(uint64_t input_operand_id,
uint64_t output_operand_id) { … }
void GraphInfoBuilder::BuildHardSigmoid(uint64_t input_operand_id,
uint64_t output_operand_id,
std::optional<float> alpha,
std::optional<float> beta) { … }
void GraphInfoBuilder::BuildHardSwish(uint64_t input_operand_id,
uint64_t output_operand_id) { … }
void GraphInfoBuilder::BuildPrelu(uint64_t input_operand_id,
uint64_t slope_operand_id,
uint64_t output_operand_id) { … }
void GraphInfoBuilder::BuildReduce(mojom::Reduce::Kind kind,
uint64_t input_operand_id,
uint64_t output_operand_id,
std::vector<uint32_t> axes,
bool keep_dimensions) { … }
void GraphInfoBuilder::BuildRelu(uint64_t input_operand_id,
uint64_t output_operand_id) { … }
void GraphInfoBuilder::BuildReshape(uint64_t input_operand_id,
uint64_t output_operand_id) { … }
void GraphInfoBuilder::BuildSigmoid(uint64_t input_operand_id,
uint64_t output_operand_id) { … }
void GraphInfoBuilder::BuildSoftmax(uint64_t input_operand_id,
uint64_t output_operand_id,
uint32_t axis) { … }
void GraphInfoBuilder::BuildSoftplus(uint64_t input_operand_id,
uint64_t output_operand_id) { … }
void GraphInfoBuilder::BuildSoftsign(uint64_t input_operand_id,
uint64_t output_operand_id) { … }
void GraphInfoBuilder::BuildTanh(uint64_t input_operand_id,
uint64_t output_operand_id) { … }
void GraphInfoBuilder::BuildTranspose(uint64_t input_operand_id,
uint64_t output_operand_id,
std::vector<uint32_t> permutation) { … }
void GraphInfoBuilder::BuildTriangular(uint64_t input_operand_id,
uint64_t output_operand_id,
bool upper,
int32_t diagonal) { … }
void GraphInfoBuilder::BuildWhere(uint64_t condition_operand_id,
uint64_t true_value_operand_id,
uint64_t false_value_operand_id,
uint64_t output_operand_id) { … }
void GraphInfoBuilder::BuildSlice(uint64_t input_operand_id,
uint64_t output_operand_id,
std::vector<uint32_t> starts,
std::vector<uint32_t> sizes) { … }
mojom::GraphInfoPtr GraphInfoBuilder::CloneGraphInfo() const { … }
mojom::GraphInfoPtr GraphInfoBuilder::TakeGraphInfo() { … }
ContextProperties GetContextPropertiesForTesting() { … }
}