You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: util.go
    path of file: ./repos/gorgonia/examples/charRNN
    
    the code of the file until where you have to start completion: package main

import (
	. "gorgonia.org/gorgonia"
	"gorgonia.org/tensor"
)

func sample(val Value) int {
	var t tensor.Tensor
	var ok bool
	if t, ok = val.(tensor.Tensor); !ok {
		panic("Expects a tens
    
func maxSample(val Value) int {
	var t tensor.Tensor
	var ok bool
	if t, ok = val.(tensor.Tensor); !ok {
		panic("expects a tensor")
	}
	indT, err := tensor.Argmax(t, -1)
	if err != nil {
		panic(err)
	}
	if !indT.IsScalar() {
		panic("Expected scalar index")
	}
	return indT.ScalarValue().(int)
}