Skip to content

Commit

Permalink
[onnx]update onnx_tensor_is_scalar function
Browse files Browse the repository at this point in the history
  • Loading branch information
jianjunjiang committed Dec 1, 2020
1 parent c0a0604 commit 97ab1d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/onnx.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ void onnx_tensor_apply(struct onnx_tensor_t * t, void * buf, size_t len);

static inline int onnx_tensor_is_scalar(struct onnx_tensor_t * t)
{
return (t->ndim > 0) ? 0 : 1;
return ((t->ndim == 0) && (t->ndata == 1)) ? 1 : 0;
}

static inline int onnx_tensor_broadcast_is_valid(struct onnx_tensor_t * x, int * dims, int ndim)
Expand Down

0 comments on commit 97ab1d3

Please sign in to comment.