mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-29 20:14:01 +00:00
nullptr
This commit is contained in:
parent
b93eba17c7
commit
f3df7e5d32
4 changed files with 12 additions and 5 deletions
|
|
@ -26,6 +26,7 @@ ONNX_CPU_OPERATOR_KERNEL(
|
|||
Status MaxUnpool::Compute(OpKernelContext* context) const {
|
||||
// Get pooled values tensor
|
||||
const Tensor* X = context->Input<Tensor>(0);
|
||||
if (X == nullptr) return Status(common::ONNXRUNTIME, common::FAIL, "input count mismatch");
|
||||
const TensorShape& X_shape = X->Shape();
|
||||
const float* X_data = X->template Data<float>();
|
||||
|
||||
|
|
@ -62,12 +63,13 @@ Status MaxUnpool::Compute(OpKernelContext* context) const {
|
|||
bool padsInferred = false;
|
||||
|
||||
if (num_inputs_ == 3) {
|
||||
auto& tensor_shape = *context->Input<Tensor>(2);
|
||||
ORT_RETURN_IF_NOT(tensor_shape.Shape().GetDims().size() == 1, "Shape must be 1 dimensional as it's tensor data is a shape");
|
||||
auto tensor_shape = context->Input<Tensor>(2);
|
||||
if (tensor_shape == nullptr) return Status(common::ONNXRUNTIME, common::FAIL, "input count mismatch");
|
||||
ORT_RETURN_IF_NOT(tensor_shape->Shape().GetDims().size() == 1, "Shape must be 1 dimensional as it's tensor data is a shape");
|
||||
|
||||
// Turn the shape tensor data into an actual shape
|
||||
const int64_t* p_shape = tensor_shape.template Data<int64_t>();
|
||||
std::vector<int64_t> shape{p_shape, p_shape + tensor_shape.Shape().Size()};
|
||||
const int64_t* p_shape = tensor_shape->template Data<int64_t>();
|
||||
std::vector<int64_t> shape{p_shape, p_shape + tensor_shape->Shape().Size()};
|
||||
givenOutputShape = shape;
|
||||
|
||||
inferredPads.resize(inferredOutputShape.size() * 2, 0);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ class IdentityOp final : public CudaKernel {
|
|||
|
||||
Status ComputeInternal(OpKernelContext* context) const override {
|
||||
const Tensor* X = context->Input<Tensor>(0);
|
||||
if (X == nullptr) return Status(common::ONNXRUNTIME, common::FAIL, "input count mismatch");
|
||||
const TensorShape& shape = X->Shape();
|
||||
Tensor* Y = context->Output(0, shape);
|
||||
auto X_type = X->DataType();
|
||||
|
|
|
|||
|
|
@ -21,7 +21,9 @@ namespace cuda {
|
|||
|
||||
template <typename T>
|
||||
Status Transpose<T>::ComputeInternal(OpKernelContext* ctx) const {
|
||||
const Tensor& X = *ctx->Input<Tensor>(0);
|
||||
const Tensor* X_ptr = ctx->Input<Tensor>(0);
|
||||
if (X_ptr == nullptr) return Status(common::ONNXRUNTIME, common::FAIL, "input count mismatch");
|
||||
const Tensor& X = *X_ptr;
|
||||
const TensorShape& input_shape = X.Shape();
|
||||
const std::vector<int64_t>& input_dims = input_shape.GetDims();
|
||||
size_t rank = input_dims.size();
|
||||
|
|
|
|||
|
|
@ -192,6 +192,7 @@ Status Sum<T>::Compute(OpKernelContext* context) const {
|
|||
std::vector<mkldnn::memory::dims> src_dims;
|
||||
|
||||
const Tensor* X1 = context->Input<Tensor>(0);
|
||||
if (X1 == nullptr) return Status(common::ONNXRUNTIME, common::FAIL, "input count mismatch");
|
||||
Tensor* Y = context->Output(0, X1->Shape());
|
||||
int dimensions = static_cast<int>(X1->Shape().NumDimensions());
|
||||
|
||||
|
|
@ -204,6 +205,7 @@ Status Sum<T>::Compute(OpKernelContext* context) const {
|
|||
|
||||
for (int i = 0; i < num_inputs; i++) {
|
||||
const Tensor* X = context->Input<Tensor>(i);
|
||||
if (X == nullptr) return Status(common::ONNXRUNTIME, common::FAIL, "input count mismatch");
|
||||
mkldnn::memory::dims src_dims_mkl(
|
||||
X->Shape().GetDims().begin(), X->Shape().GetDims().end());
|
||||
src_dims.push_back(src_dims_mkl);
|
||||
|
|
|
|||
Loading…
Reference in a new issue