#include <numeric>
#include "third_party/blink/renderer/modules/ml/webnn/ml_graph_utils.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_ml_gemm_options.h"
#include "third_party/blink/renderer/core/typed_arrays/dom_typed_array.h"
#include "third_party/blink/renderer/modules/ml/webnn/ml_operand.h"
#include "third_party/blink/renderer/modules/ml/webnn/ml_operator.h"
#include "third_party/blink/renderer/platform/heap/collection_support/heap_deque.h"
#include "third_party/blink/renderer/platform/heap/collection_support/heap_hash_set.h"
namespace blink {
namespace {
NamedArrayBufferViewsInfo;
}
HeapVector<Member<const MLOperator>>* GetOperatorsInTopologicalOrder(
const MLNamedOperands& named_outputs) { … }
std::optional<ArrayBufferViewInfo> TransferArrayBufferView(
v8::Isolate* isolate,
NotShared<DOMArrayBufferView> source_view,
ExceptionState& exception_state) { … }
DOMArrayBufferView* CreateArrayBufferView(ArrayBufferViewInfo view_info) { … }
std::unique_ptr<NamedArrayBufferViewsInfo> TransferNamedArrayBufferViews(
v8::Isolate* isolate,
const MLNamedArrayBufferViews& source_views,
ExceptionState& exception_state) { … }
MLNamedArrayBufferViews* CreateNamedArrayBufferViews(
std::unique_ptr<NamedArrayBufferViewsInfo> views_info) { … }
DOMArrayBufferView::ViewType GetArrayBufferViewType(
webnn::OperandDataType data_type) { … }
Vector<uint32_t> CreateDefaultPermutation(const wtf_size_t rank) { … }
Vector<uint32_t> CreateAllAxes(const wtf_size_t rank) { … }
Vector<uint32_t> CreateLayerNormalizationDefaultAxes(const wtf_size_t rank) { … }
base::expected<void, String> ValidateFilterLayout(
bool depthwise,
V8MLInputOperandLayout input_layout,
V8MLConv2dFilterOperandLayout filter_layout) { … }
webnn::Size2d<uint32_t> CalculateConvTransposeOutputSize2D(
const blink::MLConvTranspose2dOptions* options,
uint32_t input_height,
uint32_t input_width,
uint32_t filter_height,
uint32_t filter_width,
uint32_t stride_height,
uint32_t stride_width,
uint32_t dilation_height,
uint32_t dilation_width,
uint32_t output_padding_height,
uint32_t output_padding_width) { … }
V8MLOperandDataType ToBlinkDataType(webnn::OperandDataType data_type) { … }
webnn::OperandDataType FromBlinkDataType(V8MLOperandDataType::Enum data_type) { … }
bool IsLogicalBinaryOperator(
webnn::mojom::blink::ElementWiseBinary::Kind kind) { … }
}