The first caller of the destructor is
(gdb) f 1
#1  0x00007f6bb426cddb in torch::data::datasets::map<CustomDataset, torch::data::transforms::Normalize<at::Tensor> > (dataset=..., transform=...)
    at .../pytorch/torch/include/torch/csrc/api/include/torch/data/datasets/map.h:112
112       return {std::move(dataset), std::move(transform)};
(gdb) list
107                   DatasetType::is_stateful,
108                   typename DatasetType::BatchType::value_type,
109                   typename DatasetType::BatchType>::type,
110               typename TransformType::InputBatchType>::value,
111           "BatchType type of dataset does not match input type of transform");
112       return {std::move(dataset), std::move(transform)};
113     }
114
115     } // namespace datasets
116     } // namespace data

The second caller of the destructor is
#1  0x00007f6bb4257247 in torch::data::datasets::BatchDataset<CustomDataset, std::vector<torch::data::Example<at::Tensor, at::Tensor>, std::allocator<torch::data::Example<at::Tensor, at::Tensor> > >, c10::ArrayRef<unsigned long> >::map<torch::data::transforms::Normalize<at::Tensor> >(torch::data::transforms::Normalize<at::Tensor>) & (
    this=0x7f6bb15cc4c0, transform=...)
    at .../pytorch/torch/include/torch/csrc/api/include/torch/data/datasets/base.h:58
58          return datasets::map(static_cast<Self&>(*this), std::move(transform));
(gdb) list
53        virtual optional<size_t> size() const = 0;
54
55        /// Creates a `MapDataset` that applies the given `transform` to this dataset.
56        template <typename TransformType>
57        MapDataset<Self, TransformType> map(TransformType transform) & {
58          return datasets::map(static_cast<Self&>(*this), std::move(transform));
59        }
60
61        /// Creates a `MapDataset` that applies the given `transform` to this dataset.
62        template <typename TransformType>

Any idea on my questions? Thank you for your suggestions.