reshape_to_matrix: Turn a tensor into a matrix

View source: R/modeling.R

reshape_to_matrixR Documentation

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

## 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)

## End(Not run)

jonathanbratt/RBERT documentation built on Jan. 26, 2023, 4:15 p.m.