Skip to content

Additional operations for Transform #37

@calcuttj

Description

@calcuttj

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions