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

Function Softmax

tensorflow/core/kernels/mkl_softmax_op_test.cc:45–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43
44template <typename T>
45static Graph* Softmax(const string& kind, const TensorShape& in_shape) {
46 Graph* g = new Graph(OpRegistry::Global());
47 DataType type = DataTypeToEnum<T>::v();
48
49 const bool isDefault = (kind == "Default");
50 string op_name = isDefault ? "Softmax" : "_MklSoftmax";
51
52 // Create inputs
53 Tensor input1(type, in_shape);
54 input1.flat<T>().setRandom();
55
56 Node* input_in0 = test::graph::Constant(g, input1);
57
58 Node* not_mkl_shape =
59 test::graph::Constant(g, GetMklMetaTensor(), "not_mkl");
60 // Create NodeDef
61 auto nodeBuilder = NodeBuilder(g->NewName("softmax"), op_name)
62 .Input(input_in0);
63
64 isDefault ? nodeBuilder : nodeBuilder.Input(not_mkl_shape)
65 .Attr("_kernel", "MklLayoutDependentOp");
66
67 TF_CHECK_OK(nodeBuilder.Finalize(g, nullptr));
68
69 return g;
70}
71
72#define BM_Softmax_Base(T, kind, name, in_shape, DEVICE, NTH) \
73 static void BM_Softmax_##T##_##kind##name##_##NTH(int iters) { \

Callers 4

BM_ImageNetSoftmaxFwdFunction · 0.70
TEST_FFunction · 0.50
TEST_FFunction · 0.50
CreateMiniGraphMethod · 0.50

Calls 7

GetMklMetaTensorFunction · 0.85
ConstantFunction · 0.70
NodeBuilderClass · 0.50
InputMethod · 0.45
NewNameMethod · 0.45
AttrMethod · 0.45
FinalizeMethod · 0.45

Tested by

no test coverage detected