intersection_binary_op_with_wrapped_scalar_ Class — pytorch Architecture
Architecture documentation for the intersection_binary_op_with_wrapped_scalar_ class in SparseCsrTensorMath.cpp from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/native/sparse/SparseCsrTensorMath.cpp lines 239–251
template <typename op_t>
static Tensor& intersection_binary_op_with_wrapped_scalar_(Tensor& sparse, const Tensor& scalar, const std::string& op_name, const op_t& op) {
// NOTE: intersection_binary_op_with_wrapped_scalar_ assumes scalar.numel() == 1.
const auto broadcasted_shape = infer_size(sparse.sizes(), scalar.sizes());
if (sparse.sizes() != broadcasted_shape) {
TORCH_CHECK(false, op_name, "(): output with shape ", sparse.sizes(), " does not match ",
"the broadcast shape ", broadcasted_shape);
}
auto values = sparse.values();
// Safe to use squeeze here, we already know that scalar safely broadcasts.
op(values, scalar.squeeze());
return sparse;
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free