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 225–237
template <typename op_t>
static Tensor intersection_binary_op_with_wrapped_scalar(const Tensor& sparse, const Tensor& scalar, const op_t& op) {
// NOTE: intersection_binary_op_with_wrapped_scalar assumes scalar.numel() == 1.
const auto result_values = op(sparse.values(), scalar.squeeze()).to(at::result_type(sparse, scalar));
const auto result_sizes = infer_size(sparse.sizes(), scalar.sizes());
auto [compressed_indices, plain_indices] = getCompressedPlainIndices(sparse);
return at::_sparse_compressed_tensor_unsafe(
compressed_indices.clone(),
plain_indices.clone(),
result_values,
result_sizes,
sparse.options().dtype(result_values.scalar_type()));
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free