我试图为TysFooad实现一个Python函数,它可以从C++抽象层中的内存分配器查询内存统计信息。在TF中有没有任何例子可以让我把Python跨到C++中?我在看与SWIG相关的东西,这似乎是代码是如何做到这一点的,但它是神秘的。在这方面,一个具体的例子将大有帮助
我想重做一些内存分配算法,以潜在地提高大型模型的性能。因此,能够在模型迭代之间查询内存统计信息是至关重要的。我最初开始研究创建一个定制的tensorflow操作来获取统计数据,但在与我的团队讨论之后,我们决定最好的方法是实现一个python passthru函数,该函数可以查询可以从Keras回调之类的东西调用的统计数据
这些是我想要外部化给TensorFlow用户的字段。位于分配器中
struct AllocatorStats {
int64 num_allocs; // Number of allocations.
int64 bytes_in_use; // Number of bytes in use.
int64 peak_bytes_in_use; // The peak bytes in use.
int64 largest_alloc_size; // The largest single allocation seen.
// The upper limit of bytes of user allocatable device memory, if such a limit
// is known.
absl::optional<int64> bytes_limit;
// Stats for reserved memory usage.
int64 bytes_reserved; // Number of bytes reserved.
int64 peak_bytes_reserved; // The peak number of bytes reserved.
// The upper limit on the number bytes of reservable memory,
// if such a limit is known.
absl::optional<int64> bytes_reservable_limit;
目前没有回答
相关问题 更多 >
编程相关推荐