SetData

Function Usage

Sets data to a tensor.

Prototype

APIs taking string arguments will be deprecated in future releases. Use APIs taking non-string arguments instead.

1
2
3
4
5
6
7
8
graphStatus SetData(std::vector<uint8_t> &&data)
graphStatus SetData(const std::vector<uint8_t> &data)
graphStatus SetData(const uint8_t *data, size_t size)
graphStatus SetData(const std::string &data)
graphStatus SetData(const char_t *data)
graphStatus SetData(const std::vector<std::string> &data)
graphStatus SetData(const std::vector<AscendString> &datas)
graphStatus SetData(uint8_t *data, size_t size, const Tensor::DeleteFunc &deleter_func)

Parameters

Parameter

Input/Output

Description

data/datas

Input

Data to be set.

size

Input

Data length, in bytes.

deleter_func

Input

Function that clears data.

using DeleteFunc = std::function<void(uint8_t *)>;

Returns

graphStatus type. GRAPH_SUCCESS on success; GRAPH_FAILED on failure.

Exception Handling

None

Constraints

None