IncliArray
Loading...
Searching...
No Matches
utils.h
Go to the documentation of this file.
1
9#pragma once
10
11#include <vector>
12
13namespace detail {
19std::vector<int> _computeStrides(std::vector<int> newShape);
20
27std::vector<int> _broadcastShape(std::vector<int> a, std::vector<int> b);
28
38std::vector<int> _broadcastStrides(std::vector<int> originalShape,
39 std::vector<int> originalStrides,
40 std::vector<int> targetShape);
41
48int _computeOffset(std::vector<int> index, std::vector<int> strides);
49} // namespace detail
Definition utils.h:13
std::vector< int > _broadcastShape(std::vector< int > a, std::vector< int > b)
Computes the broadcasted shape of a and b together.
Definition utils.cpp:22
int _computeOffset(std::vector< int > index, std::vector< int > strides)
Computes offset based on the index and strides.
Definition utils.cpp:64
std::vector< int > _computeStrides(std::vector< int > newShape)
Computes strides from a new shape.
Definition utils.cpp:4
std::vector< int > _broadcastStrides(std::vector< int > originalShape, std::vector< int > originalStrides, std::vector< int > targetShape)
Computes the broadcasted strides based on original shape and strides, and target shape.
Definition utils.cpp:44