1 #include "caffe2/experiments/operators/sparse_matrix_reshape_op.h" 6 REGISTER_CPU_OPERATOR(SparseMatrixReshape, SparseMatrixReshapeOp<CPUContext>);
8 OPERATOR_SCHEMA(SparseMatrixReshape)
11 .AllowInplace({{0, 0}, {1, 1}})
13 Compute the indices of the reshaped sparse matrix. 15 It takes two 1D tensors as input: the column indices (in int64) and 16 the row indices (in int), which correspond to `INDICES` and `SEGMENT_IDS` 17 in `SparseSortedSegment` family. 18 It outputs the corresponding reshaped column and row indices. 20 Two arguments are required: 21 an argument `old_shape` specifies the original shape of the matrix, 22 and `new_shape` specifies the new shape. 23 One of the dimension in `old_shape` and `new_shape` can be -1. 24 The valid combinations are listed below, where p, q, r, s are 25 strictly positive integers. 39 Note that only the first dimension in `old_shape` can be -1. In that case 40 the second dimension in `new_shape` must NOT be -1. 42 .Arg("old_shape",
"Old shape.")
43 .Arg(
"new_shape",
"New shape.")
44 .Input(0,
"old_col",
"Original column indices.")
45 .Input(1,
"old_row",
"Original row indices.")
46 .Output(0,
"new_col",
"New column indices.")
47 .Output(1,
"new_row",
"New row indices.");
49 SHOULD_NOT_DO_GRADIENT(SparseMatrixReshape);
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...