1 #include "caffe2/operators/index_hash_ops.h" 6 REGISTER_CPU_OPERATOR(IndexHash, IndexHashOp<CPUContext>);
8 OPERATOR_SCHEMA(IndexHash)
12 This operator translates a list of indices into a list of hashed indices. 13 A seed can be fed as an argument to change the behavior of the hash function. 14 If a modulo is specified, all the hashed indices will be modulo the 15 specified number. All input and output indices are enforced to be positive. 17 .Input(0, "Indices",
"Input feature indices.")
18 .Output(0,
"HashedIndices",
"Hashed feature indices.")
19 .Arg(
"seed",
"seed for the hash function")
20 .Arg(
"modulo",
"must be > 0, hashed ids will be modulo this number")
21 .TensorInferenceFunction([](
const OperatorDef& ,
22 const vector<TensorShape>& in) {
23 std::vector<TensorShape> out(1);
24 std::vector<int64_t> output_dims = GetDimsVector(in[0]);
25 out[0] = CreateTensorShape(output_dims, in[0].data_type());
29 SHOULD_NOT_DO_GRADIENT(IndexHash);
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...