MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Create

Function Create

tensorflow/core/util/sparse/sparse_tensor.h:51–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49 typedef typename gtl::InlinedVector<int64, 8> ShapeArray;
50
51 static Status Create(Tensor ix, Tensor vals, const VarDimArray shape,
52 const VarDimArray order, SparseTensor* result) {
53 if (ix.dtype() != DT_INT64) {
54 return Status(
55 error::INVALID_ARGUMENT,
56 strings::StrCat("indices must be type int64 but got: ", ix.dtype()));
57 }
58 if (!TensorShapeUtils::IsVector(vals.shape())) {
59 return Status(error::INVALID_ARGUMENT,
60 strings::StrCat("vals must be a vec, but got: ",
61 vals.shape().DebugString()));
62 }
63 if (ix.shape().dim_size(0) != vals.shape().dim_size(0)) {
64 return Status(error::INVALID_ARGUMENT,
65 strings::StrCat("indices and values rows (indexing "
66 "dimension) must match. (indices = ",
67 ix.shape().dim_size(0), ", values = ",
68 vals.shape().dim_size(0), ")"));
69 }
70 int dims = 0;
71 TF_RETURN_IF_ERROR(GetDimsFromIx(ix, &dims));
72 if (order.size() != dims) {
73 return Status(error::INVALID_ARGUMENT,
74 "Order length must be SparseTensor rank.");
75 }
76 if (shape.size() != dims) {
77 return Status(error::INVALID_ARGUMENT,
78 "Shape rank must be SparseTensor rank.");
79 }
80
81 *result = SparseTensor(ix, vals, shape, order);
82 return Status();
83 }
84
85 static Status Create(Tensor ix, Tensor vals, const TensorShape& shape,
86 SparseTensor* result) {

Callers 15

SplitMethod · 0.70
TESTFunction · 0.70
BM_SparseReorderFloatFunction · 0.70
BM_SparseReorderStringFunction · 0.70
TEST_FFunction · 0.50
InitMethod · 0.50
InitMethod · 0.50
NewServerMethod · 0.50
NewServerMethod · 0.50
NewServerMethod · 0.50
TEST_FFunction · 0.50
InitializeMethod · 0.50

Calls 10

TensorShapeToVectorFunction · 0.85
UndefinedOrderFunction · 0.85
SparseTensorFunction · 0.70
StatusClass · 0.50
StrCatFunction · 0.50
dtypeMethod · 0.45
shapeMethod · 0.45
DebugStringMethod · 0.45
dim_sizeMethod · 0.45
sizeMethod · 0.45

Tested by 15

TESTFunction · 0.56
BM_SparseReorderFloatFunction · 0.56
BM_SparseReorderStringFunction · 0.56
TEST_FFunction · 0.40
TEST_FFunction · 0.40
TEST_FFunction · 0.40
DelegateTestMethod · 0.40
RunTestFunction · 0.40
RunTestFunction · 0.40
TEST_FFunction · 0.40
TEST_FFunction · 0.40
MakeContextMethod · 0.40