Learn R Programming

RBERT (version 0.1.11)

reshape_to_matrix: Turn a tensor into a matrix

Description

Reshapes a >= rank 2 tensor to a rank 2 tensor. The last dimension is preserved; the rest are flattened.

Usage

reshape_to_matrix(input_tensor)

Arguments

input_tensor

Tensor to reshape.

Value

The Tensor reshaped to rank 2.

Examples

Run this code
# NOT RUN {
with(
  tensorflow::tf$variable_scope("examples",
    reuse = tensorflow::tf$AUTO_REUSE
  ),
  r3t <- tensorflow::tf$get_variable("r3t",
    dtype = "int32",
    shape = c(10, 20, 3)
  )
)
reshape_to_matrix(r3t)
# }

Run the code above in your browser using DataLab