17 #include "caffe2/experiments/operators/sparse_matrix_reshape_op.h" 22 REGISTER_CPU_OPERATOR(SparseMatrixReshape, SparseMatrixReshapeOp<CPUContext>);
24 OPERATOR_SCHEMA(SparseMatrixReshape)
27 .DisallowInputFillers()
28 .AllowInplace({{0, 0}, {1, 1}})
30 Compute the indices of the reshaped sparse matrix. 32 It takes two 1D tensors as input: the column indices (in int64) and 33 the row indices (in int), which correspond to `INDICES` and `SEGMENT_IDS` 34 in `SparseSortedSegment` family. 35 It outputs the corresponding reshaped column and row indices. 37 Two arguments are required: 38 an argument `old_shape` specifies the original shape of the matrix, 39 and `new_shape` specifies the new shape. 40 One of the dimension in `old_shape` and `new_shape` can be -1. 41 The valid combinations are listed below, where p, q, r, s are 42 strictly positive integers. 56 Note that only the first dimension in `old_shape` can be -1. In that case 57 the second dimension in `new_shape` must NOT be -1. 59 .Arg("old_shape",
"Old shape.")
60 .Arg(
"new_shape",
"New shape.")
61 .Input(0,
"old_col",
"Original column indices.")
62 .Input(1,
"old_row",
"Original row indices.")
63 .Output(0,
"new_col",
"New column indices.")
64 .Output(1,
"new_row",
"New row indices.");
66 SHOULD_NOT_DO_GRADIENT(SparseMatrixReshape);
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...