Caffe2 - C++ API
A deep learning, cross platform ML framework
tensor.h
1 #pragma once
2 
3 #include <torch/serialize/archive.h>
4 #include <torch/types.h>
5 
6 namespace torch {
7 inline serialize::OutputArchive& operator<<(
8  serialize::OutputArchive& archive,
9  const Tensor& tensor) {
10  archive.write("0", tensor);
11  return archive;
12 }
13 
14 inline serialize::InputArchive& operator>>(
15  serialize::InputArchive& archive,
16  Tensor& tensor) {
17  archive.read("0", tensor);
18  return archive;
19 }
20 } // namespace torch
void read(const std::string &key, Tensor &tensor, bool is_buffer=false)
Reads a tensor associated with a given key.
Definition: jit_type.h:17