At some point, a user might want to implement an operation for some purpose
I.e. one might want something like this to multiply/collapse over a dimension
if (opcfg.operation == "prod") {
m_ops.push_back([dims](const torch::Tensor& tensor) -> torch::Tensor {
if (dims.size() != 1) {
raise("prod transform requires 1 values in dims config, got %d",
dims.size());
}
return torch::prod(tensor, dims[0], true); //Squeeze if you want to not keepdim
});
continue;
}
In fact, while testing an implementation for something else, I did add this. I realized I didn't need it so I removed it so as to not bloat the Transform class. That being said, we should have some policy/plan for adding a potentially open-ended set of operations
At some point, a user might want to implement an operation for some purpose
I.e. one might want something like this to multiply/collapse over a dimension
if (opcfg.operation == "prod") { m_ops.push_back([dims](const torch::Tensor& tensor) -> torch::Tensor { if (dims.size() != 1) { raise("prod transform requires 1 values in dims config, got %d", dims.size()); } return torch::prod(tensor, dims[0], true); //Squeeze if you want to not keepdim }); continue; }In fact, while testing an implementation for something else, I did add this. I realized I didn't need it so I removed it so as to not bloat the Transform class. That being said, we should have some policy/plan for adding a potentially open-ended set of operations