mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-29 20:14:01 +00:00
Slice
This commit is contained in:
parent
be0c0da9ef
commit
13dabd97b6
2 changed files with 20 additions and 1 deletions
|
|
@ -32,6 +32,23 @@ void HandleNegativeAxes(gsl::span<int32_t> onnxAxes, uint32_t dimCount)
|
|||
}
|
||||
}
|
||||
|
||||
void FillWithLeadingValues(/*inout*/ std::vector<uint32_t>& values, uint32_t minimumElementCount, uint32_t fillValue)
|
||||
{
|
||||
// e.g.
|
||||
// input = [6,7]
|
||||
// elementCount = 4
|
||||
// fillValue = 1
|
||||
// output = [1,1,6,7]
|
||||
|
||||
const size_t oldElementCount = values.size();
|
||||
const size_t newElementCount = std::max(size_t(minimumElementCount), oldElementCount);
|
||||
const size_t fillCount = newElementCount - oldElementCount;
|
||||
|
||||
values.resize(newElementCount);
|
||||
std::copy_backward(values.data(), values.data() + oldElementCount, values.data() + fillCount);
|
||||
std::fill_n(values.data(), fillCount, fillValue);
|
||||
}
|
||||
|
||||
int64_t ReadAsInt64(MLOperatorTensorDataType tensorDataType, const void* p)
|
||||
{
|
||||
switch (tensorDataType)
|
||||
|
|
|
|||
|
|
@ -75,6 +75,8 @@ void RemoveValuesByIndex(gsl::span<const uint32_t> indices, bool keepOneValue, /
|
|||
values.resize(newValuesCount);
|
||||
}
|
||||
|
||||
void FillWithLeadingValues(/*inout*/ std::vector<uint32_t>& values, uint32_t minimumElementCount, uint32_t fillValue);
|
||||
|
||||
int64_t ReadAsInt64(MLOperatorTensorDataType tensorDataType, const void* p);
|
||||
|
||||
class EdgeShapes {
|
||||
|
|
@ -641,7 +643,7 @@ public:
|
|||
std::vector<DimensionType> m_outputDimensions;
|
||||
std::vector<uint32_t> m_offsets;
|
||||
std::vector<uint32_t> m_sizes;
|
||||
std::vector<uint32_t> m_strides;
|
||||
std::vector<int32_t> m_strides;
|
||||
};
|
||||
|
||||
class SliceHelper : public SliceHelperBase
|
||||
|
|
|
|||
Loading…
Reference in a new issue