mirror of
https://github.com/nomic-ai/kompute.git
synced 2026-05-11 17:09:59 +00:00
disallowing zero sized tensors
This commit is contained in:
@@ -113,3 +113,21 @@ TEST(TestOpTensorCreate, NoErrorIfTensorFreedBefore)
|
||||
EXPECT_FALSE(tensorA->isInit());
|
||||
EXPECT_FALSE(tensorB->isInit());
|
||||
}
|
||||
|
||||
|
||||
TEST(TestOpTensorCreate, ExceptionOnZeroSizeTensor)
|
||||
{
|
||||
std::vector<float> testVecA;
|
||||
|
||||
std::shared_ptr<kp::Tensor> tensorA{ new kp::Tensor(testVecA) };
|
||||
|
||||
kp::Manager mgr;
|
||||
|
||||
try{
|
||||
mgr.evalOpDefault<kp::OpTensorCreate>({ tensorA });
|
||||
} catch( const std::runtime_error& err ) {
|
||||
// check exception
|
||||
ASSERT_STREQ("Kompute Tensor attempted to create a zero-sized buffer", err.what() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user