Class Base

Inheritance Relationships

Derived Types

Class Documentation

class Base

Base is the base class of many api classes, which provides basic interfaces.

Subclassed by mindspore::api::AbstractBase, mindspore::api::AnfNode, mindspore::api::Shape, mindspore::api::Value

Public Functions

explicit Base(const std::shared_ptr<mindspore::Base> &impl)

Create an instance from the given implementation object.

Parameters

impl[in] The shared_ptr to the implementation object.

virtual ~Base() = default

Destructor of Base.

inline const std::shared_ptr<mindspore::Base> &impl() const

Get the shared_ptr to the underly implementation object.

Returns

The shared_ptr to the underly implementation object.

std::string ToString() const

Get the string representation of this object.

Returns

The string representation.

template<typename T, typename = typename std::enable_if_t<std::is_base_of_v<Base, T>, T>>
inline bool isa() const

Check whether this object is an instance of the given class.

Returns

True if this object is an instance of the given class, false otherwise.

template<typename T, typename U = typename std::enable_if_t<is_wrapper_ptr<T>::value, typename T::element_type>>
inline T cast()

Cast this object to a pointer with the given pointer class.

Returns

A non-null pointer if cast success, nullptr otherwise.

Public Static Functions

static uint32_t ClassId()

Get the id of this class.

Returns

The id of this class.