Use Functional operations and calculations#

Note

  • Apart the Tensor built-in methods, we can also call on the operation and calculation packages Functional Interface implemented.

  • To quickly browse or retrieve all related APIs and routines, please refer to the megengine.functional page.

注意 Tensor 数据类型

Tensor 之间进行计算时需要考虑到对输入数据类型的支持情况,通常默认输入 Tesnor 为 float32 类型, 将不支持的数据类型 Tensor 作为输入可能将无法进行计算,请参考 Tensor data type 中的介绍。

术语概念区分

Most of the time, we will of Tensor operations and operations divided into two concepts:

  • Manipulation of a single Tensor, usually its attributes (such as shape, equipment, type, etc.) have changed;

  • Operations can be performed between Tensors, which are usually calculated based on the values of the elements in the Tensor.

而有些时候它们概念一致,彼此之间可以互相指代(取决于上下文)。 但可以确定的一点是,不论如何称呼这些行为,它们都可以从 functional 包中能找到, 也可用 “算子(Operators)” 来称呼相关行为。

Common API Reference operate differently than classification, the present document will Tensor / calculation of the following types are introduced: