ExamGecko
Question list
Search
Search

List of questions

Search

Question 7 - H13-311_V3.5 discussion

Report
Export

When you use MindSpore to execute the following code, which of the following is the output?

from mindspore import ops

import mindspore

shape = (2, 2)

ones = ops.Ones()

output = ones(shape, dtype=mindspore.float32)

print(output)

A.
[[1 1] [1 1]]
Answers
A.
[[1 1] [1 1]]
B.
[[1. 1.] [1. 1.]]
Answers
B.
[[1. 1.] [1. 1.]]
C.
1
Answers
C.
1
D.
[[1. 1. 1. 1.]]
Answers
D.
[[1. 1. 1. 1.]]
Suggested answer: B

Explanation:

In MindSpore, using ops.Ones() with a specified shape and dtype=mindspore.float32 will create a tensor of ones with floating-point values. The output will be a 2x2 matrix filled with 1.0 values. The floating-point format (with a decimal point) ensures that the output is in the form of [[1. 1.], [1. 1.]].

asked 26/09/2024
Kimon Pope
32 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first