tensorflow/cc/experimental/base/tests/tensor_test.cc
// This test constructs a scalar tensor for each of the types in "SimpleTypes",
// and verifies the expected dimensions, dtype, value, number of bytes, and
// number of elements.
This test constructs a scalar tensor for each of the types in "SimpleTypes",
and verifies the expected dimensions, dtype, value, number of bytes, and
number of elements.
This test constructs a scalar tensor for each of the types in " SimpleTypes " and verifies the expected dimensions dtype value number of bytes and number of elements .
TYPED_TEST(ConstructScalarTensorTest, ValidTensorAttributesAfterConstruction) {
  Status status;
  TF_DataType dtype = TypeParam::kDType;
  typename TypeParam::type value = 42;
  Tensor tensor = Tensor::FromBuffer(dtype, {},
                                     &value,
                                     sizeof(value),
                                     [](void*, size_t) {}, &status);
  ASSERT_TRUE(status.ok()) << status.message();
  EXPECT_EQ(tensor.dims(), 0);
  EXPECT_EQ(tensor.dtype(), dtype);
  EXPECT_EQ(*reinterpret_cast<typename TypeParam::type*>(tensor.data()), 42);
  EXPECT_EQ(tensor.num_bytes(), sizeof(typename TypeParam::type));
  EXPECT_EQ(tensor.num_elements(), 1);
}
TYPED_TEST ( ConstructScalarTensorTest , ValidTensorAttributesAfterConstruction ) { Status status ; TF_DataType dtype = TypeParam :: kDType ; typename TypeParam :: type value = 42 ; Tensor tensor = Tensor :: FromBuffer ( dtype , { } , & value , sizeof ( value ) , [ ] ( void * , size_t ) { } , & status ) ; ASSERT_TRUE ( status . ok ( ) ) << status . message ( ) ; EXPECT_EQ ( tensor . dims ( ) , 0 ) ; EXPECT_EQ ( tensor . dtype ( ) , dtype ) ; EXPECT_EQ ( * reinterpret_cast < typename TypeParam :: type * > ( tensor . data ( ) ) , 42 ) ; EXPECT_EQ ( tensor . num_bytes ( ) , sizeof ( typename TypeParam :: type ) ) ; EXPECT_EQ ( tensor . num_elements ( ) , 1 ) ; }
This test constructs a scalar tensor for each of the types in "SimpleTypes",
and verifies the expected dimensions, dtype, value, number of bytes, and
number of elements.
This test constructs a scalar tensor for each of the types in " SimpleTypes " and verifies the expected dimensions dtype value number of bytes and number of elements .
/*dtype=*/ /*shape=*/ /*data=*/ /*len=*/ /*deleter=*/