File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
cpp/include/tensorrt_llm/runtime Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ class ITensor : virtual public IBuffer
7171 [[nodiscard]] DimType64 getDimension () const
7272 {
7373 auto const shape = getShape ();
74- static_assert (n < shape. MAX_DIMS && n >= -shape. MAX_DIMS ,
74+ static_assert (n < Shape:: MAX_DIMS && n >= -Shape:: MAX_DIMS,
7575 " Trying to access the dimension of a tensor, when its maximal shape cannot have that dimension." );
7676 if constexpr (n < 0 )
7777 {
@@ -126,6 +126,11 @@ class ITensor : virtual public IBuffer
126126 {
127127 auto const vol = volume (shape);
128128 TLLM_CHECK_WITH_INFO (0 <= vol, " Invalid tensor shape" );
129+ if constexpr (sizeof (std::size_t ) == 4 )
130+ {
131+ TLLM_CHECK_WITH_INFO (vol <= static_cast <std::int64_t >(std::numeric_limits<std::size_t >::max ()),
132+ " Tensor volume exceeds 32-bit size_t maximum capacity." );
133+ }
129134 return static_cast <std::size_t >(vol);
130135 }
131136
You can’t perform that action at this time.
0 commit comments